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( 'curatewp_section_objects_cache_time', function() { | |
// Change the cache time to hourly. | |
return HOUR_IN_SECONDS; | |
} ); |
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( 'curatewp_section_cache_time', function() { | |
// Change the cache time to hourly. | |
return HOUR_IN_SECONDS; | |
} ); |
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( 'curatewp_section_object_query_args', function( $query_args, $section ) { | |
// Alter the query args for a specific section. | |
if ( 'your-section-name' === $section->post_name ) { | |
$query_args[ 'category__no_in' ] = [ 2, 54 ]; | |
} | |
// Pass back the altered query 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
<?php | |
add_filter( 'curatewp_template_dir', function( $template_dir ) { | |
// Change the template directory in your Parent or Child theme. | |
return 'curation_templates'; | |
} ); |
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( 'curatewp_section_layout_args', function( $layout_args, $section ) { | |
// Change all section featured posts layout to the "Hero". | |
$layout_args['layout-featured-posts'] = 'hero'; | |
return $layout_args; | |
}, 10, 2 ); |
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( 'curatewp_section_posts', function( $curated_posts, $section ) { | |
// Filter out a post with the ID of 25. | |
return array_filter( $curated_posts, function( $post_id ) { | |
return 25 !== $post_id; | |
} ); | |
}, 10, 2 ); |
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 | |
// Prevent loading the layout css. | |
add_filter( 'curatewp_load_layout_css', '__return_false' ); |
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 the 'current-menu-ancestor' class to a parent page menu item where the child page is not part of the menu. | |
* | |
* @param array $classes The CSS classes that are applied to the menu item's <li> element | |
* @param WP_Post $item The current menu item | |
* | |
* @return array The filtered CSS classes. | |
*/ |
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 | |
/** | |
* Generate markup for the featured image above each page. | |
* | |
* If a featured image does not exist for the current page we will try and pull one from the parent page. If we still | |
* haven't found a featured image we will try and pull one from the 'page_on_front' (when using a static front-page). | |
* Otherwise we show nothing. | |
*/ | |
function featured_image( $size = 'post-thumbnail' ) |
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 | |
// OH GOD NO | |
$object = new ClassName(); | |
class ClassName { | |
function method_one() | |
{ | |
global $object; | |
$object->method_two(); |