Skip to content

Instantly share code, notes, and snippets.

@chipbennett
Created September 2, 2011 17:40
Show Gist options
  • Save chipbennett/1189257 to your computer and use it in GitHub Desktop.
Save chipbennett/1189257 to your computer and use it in GitHub Desktop.
Example hook callback with contextual conditionals
/**
* Hook into hypothetical action hook
*/
function themeslug_after_post() {
// Let's only do something on
// single blog posts
if ( is_single() ) {
// output a hypothetical related posts function
related_posts();
}
}
// Hook our callback into the hypothetical 'after_post' hook
add_action( 'after_post', 'themeslug_after_post' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment