Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Last active August 29, 2015 14:02
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 rfmeier/d87c2fd0352b428d20a9 to your computer and use it in GitHub Desktop.
Save rfmeier/d87c2fd0352b428d20a9 to your computer and use it in GitHub Desktop.
Display post format icon only on pages in Genesis.
<?php
// remove the default Genesis callbacks
remove_action( 'genesis_entry_header', 'genesis_do_post_format_image', 4 );
remove_action( 'genesis_before_post_title', 'genesis_do_post_format_image' );
add_action( 'genesis_entry_header', 'custom_genesis_do_post_format_image', 4 );
add_action( 'genesis_before_post_title', 'custom_genesis_do_post_format_image' );
/**
* Callback for Genesis 'genesis_entry_header' or 'genesis_before_post_title' action.
*
* If the current post object is a page exit. Else, display the post format icon.
*
* @author Ryan Meier http://www.rfmeier.net/
*
* @return void
*/
function custom_genesis_do_post_format_image(){
// if on a page, return
if( is_page() )
return;
// call the default Gensis post format image function
genesis_do_post_format_image();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment