Skip to content

Instantly share code, notes, and snippets.

@jbd91
jbd91 / snippet.scss
Created February 2, 2018 21:50
Gravity Form Placeholder Text Overrides
::-webkit-input-placeholder { /* Chrome */
color: #1E1F22 !important;
}
:-ms-input-placeholder { /* IE 10+ */
color: #1E1F22 !important;
}
::-moz-placeholder { /* Firefox 19+ */
color: #1E1F22 !important;
opacity: 1 !important;
}
@jbd91
jbd91 / snippet.php
Created February 2, 2018 21:56
Get Terms
<p>
<?php
$terms = get_the_terms($post->ID, 'taxonomy');
if ($terms) {
foreach ($terms as $term) {
echo '<span>' . $term->name . '</span>';
}
}
?>
</p>
@jbd91
jbd91 / snippet.php
Created February 5, 2018 15:52
ACF Get Tax Term Page Field Data
// GET TAXONOMY TERM DATA (NATIVE AND ACF)
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
$term_slug = $queried_object->slug;
$content = get_field('content', $taxonomy . '_' . $term_id);
$featured_image = get_field('featured_image', $taxonomy . '_' . $term_id);
@jbd91
jbd91 / snippet.php
Created February 6, 2018 05:01
WP Query Pagination
// Goes after the endwhile before reset post data
<div class="pagination">
<?php
echo paginate_links( array(
'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
'total' => $query->max_num_pages,
'current' => max( 1, get_query_var( 'paged' ) ),
'format' => '?paged=%#%',
'show_all' => false,
@jbd91
jbd91 / snippet.scss
Created February 6, 2018 22:28
Print Style Media Queries
@mixin hide-for-print {
@media print {
display: none;
}
}
@mixin show-for-print {
@media print {
@jbd91
jbd91 / snippet.js
Last active April 3, 2018 16:00
Match Height
$('.div').matchHeight();
$('.div').matchHeight({byRow: false});
@jbd91
jbd91 / snippet.php
Created February 7, 2018 20:28
ACF Settings Page
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
@jbd91
jbd91 / snippet.php
Created February 7, 2018 22:43
WP Config Redirect
// Redirect non-existant single post page to primary listing page
if (preg_match('/^\/blog\/technician/', $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: /technician-locator');
exit();
}
@jbd91
jbd91 / snippet.scss
Last active April 19, 2018 16:28
Media Queries
@media screen and (max-width: 1800px) {
}
@media screen and (max-width: 1200px) {
}
@media screen and (max-width: 900px) {
@jbd91
jbd91 / snippet.php
Last active October 23, 2019 16:12
ACF Taxonomy Field WP Query Based Off Term Selected
<?php
// TAXONOMY
$terms = get_field('resource_listing');
if ($terms) :
if (is_array($terms)) {
$terms = implode(',', $terms);
}
$args = [
'post_type' => 'resource',
'posts_per_page' => -1,