This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('widgets_init', 'gpb_register_sidebar'); | |
/** | |
* Dynamically register sidebar for pages that use specified template | |
* | |
*/ | |
function gpb_register_sidebar() { | |
global $post; | |
global $wp_registered_sidebars; | |
// Find all pages that use template with dynamic sidebar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$gallery = get_post_meta( get_the_ID(), 'home_slider'); // 'home_slider' is name of my ACF gallery field | |
$image_ids = $gallery[0]; // It's an array within an array | |
// If we have some images loop around and populate a new data array | |
if( is_array( $image_ids )) { | |
$image_ids_string = implode( ',', $image_ids ); // Soliloquy Dynamic requires image IDs to be passed as a comma separated list | |
echo '<div class="gallery-slider">'; | |
soliloquy_dynamic( array( | |
'id' => 'gallery-images', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'oembed_providers', 'oembed_fix_twitter', 10, 1 ); | |
function oembed_fix_twitter( $providers ) { | |
$providers[ '#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' ] = array( 'https://api.twitter.com/1/statuses/oembed.{format}', true ); | |
return $providers; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
add_filter( "genesis_structural_wrap-footer-widgets", 'jmw_filter_footer_widgets_structural_wrap', 10, 2); | |
/** | |
* Filter the footer-widgets context of the genesis_structural_wrap to add a div before the closing wrap div. | |
* | |
* @param string $output The markup to be returned | |
* @param string $original_output Set to either 'open' or 'close' | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Don't include the above. | |
add_filter( 'genesis_get_image_default_args', 'prefix_stop_auto_featured_image' ); | |
/** | |
* Stop Genesis archives from using first attached image as fallback when no featured image is set. | |
* | |
* @param array $args Default image arguments. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register and Hook Top Navigation Menu | |
add_action('genesis_before_header', 'sample_before_header_menu', 10); | |
function sample_before_header_menu() { | |
register_nav_menu( 'top', 'Top Navigation Menu' ); | |
genesis_nav_menu( array( | |
'theme_location' => 'top', | |
'menu_class' => 'menu genesis-nav-menu menu-top', | |
) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'leaven_search_hide_landing_page' ); | |
/** | |
* Remove landing pages from the search results. | |
* | |
* @param $query \WP_Query | |
* | |
* @return mixed | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Make sure to prefix the function if you do not use a namespace. | |
// namespace TimJensen\HelperFunctions; | |
/** | |
* Returns an auto generated post excerpt, or a manual excerpt if one has been set. | |
* | |
* @version 1.2.1 | |
* | |
* @param int $post_id Required. Post ID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add a apply_to and in_use column to Oxygenbuilder2.0's ct_templates overview. | |
* It will: | |
* - tell you the rules on the templates | |
* - show you if a re-usable is being used on a post/page/cpt so if not, you can safely delete it. | |
*/ | |
add_filter('manage_edit-ct_template_columns', 'add_new_ct_template_columns'); | |
/** |
OlderNewer