Skip to content

Instantly share code, notes, and snippets.

@jbd91
jbd91 / snippet.php
Last active February 2, 2018 03:48
WP Query - Children of Parent Page
<?php
$args = [
'post_type' => 'page',
'posts_per_page' => -1,
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'menu_order'
];
@jbd91
jbd91 / snippet.php
Last active May 11, 2018 15:12
Gravity Forms Tab Index Fix
// Fix Gravity Form Tabindex Conflicts
add_filter( 'gform_tabindex', 'gform_tabindexer', 10, 2 );
function gform_tabindexer( $tab_index, $form = false ) {
$starting_index = 1000; // if you need a higher tabindex, update this number
if( $form )
add_filter( 'gform_tabindex_' . $form['id'], 'gform_tabindexer' );
return GFCommon::$tab_index >= $starting_index ? GFCommon::$tab_index : $starting_index;
}
@jbd91
jbd91 / snippet.php
Created February 2, 2018 03:45
Custom Fields Search
/**
* Extend WordPress search to include custom fields
*
* https://adambalee.com
*/
/**
* Join posts and postmeta tables
*
* http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join
@jbd91
jbd91 / snippet.php
Last active May 15, 2018 15:45
WP Query - Related Posts - Custom Post Type
<?php
$custom_taxterms = wp_get_object_terms( $post->ID, 'related-service', array('fields' => 'ids') );
$args =
[
'post_type' => 'post',
'posts_per_page' => 5,
'post__not_in' => [$post->ID],
'tax_query' => [
[
@jbd91
jbd91 / snippet.php
Created February 2, 2018 03:50
Yoast to Bottom
// Move yoast seo plugin to bottom of meta box order in WP dashboard
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
@jbd91
jbd91 / snippet.scss
Created February 2, 2018 03:51
Overlay
.div {
background-color: rgba(#000, 0.5);
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
&:before {
content: '';
background-color: inherit;
@jbd91
jbd91 / snippet.scss
Created February 2, 2018 03:53
Flex Box
.listing-items {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
.listing-item {
margin: 1rem;
width: calc(100% / 3 - 2rem);
@jbd91
jbd91 / snippet.scss
Created February 2, 2018 03:54
Slick Focus
.slick-slide {
&:focus {
outline: none;
}
}
@jbd91
jbd91 / snippet.scss
Created February 2, 2018 03:54
Captcha Size Fix
.ginput_recaptcha {
transform:scale(0.62) !important;
-webkit-transform:scale(0.62) !important;
transform-origin:0 0 !important;
-webkit-transform-origin:0 0 !important;
}
@jbd91
jbd91 / snippet.scss
Created February 2, 2018 03:55
Sticky Navigation Admin Bar Fix
.admin-bar {
#sticky-nav--container {
&.sticky {
top: 32px;
@media screen and (max-width: 600px) {
top: 0;
}