Skip to content

Instantly share code, notes, and snippets.

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/cbced7f608a924b65c22 to your computer and use it in GitHub Desktop.
Save calliaweb/cbced7f608a924b65c22 to your computer and use it in GitHub Desktop.
Add title above posts only if there are posts
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_before_while', 'custom_add_title_before_loop' );
/*
* Echo out the title
* The genesis_before_while runs after the if( have_posts() )
* and before while( have_posts() ) : the_post();
*/
function custom_add_title_before_loop() {
echo '<h2>My Title</h2>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment