Skip to content

Instantly share code, notes, and snippets.

@calliaweb
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calliaweb/0a7ced51c000fcb58f87 to your computer and use it in GitHub Desktop.
Save calliaweb/0a7ced51c000fcb58f87 to your computer and use it in GitHub Desktop.
<?php
// Do NOT include the opening php tag above
/**
* Helper function to determine if we're on a blog section of a Genesis site.
*
* @since 2.0.0
*
* @param $archives_only set to false to return true on singular posts
* @return bool True if we're on any section of the blog.
*/
function foodie_pro_is_blog( $archives_only = true ) {
$is_blog = array(
'blog_template' => genesis_is_blog_template(),
'single_post' => $archives_only ? false : is_singular( 'post' ),
'archive' => is_archive() && ! is_post_type_archive(),
'home' => is_home() && ! is_front_page(),
'search' => is_search(), // Add this line to enable the grid on the search pages too
);
if ( in_array( true, $is_blog ) ) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment