There’s 2 ways to reposition the entry title or page title as some call it in Genesis child themes without also moving the single post titles and the post titles on archive page types like the blog page.
- You can add the hooks to remove the title and entry header markup before and after the title, to a page template in your child theme root directory.
- Or you can add the hooks to a custom function with conditional tag in your child themes functions file. This will remove and add back the title in any genesis hook position
1. Page Template
Create a file named page.php in your child themes root directory and add the following code:
The above code will reposition the entry title on all single and archive page types.
2. Custom Function
Added to your child themes functions file, the following PHP code will reposition the page title on single pages only and NOT on archive pages.
add_action( 'genesis_meta', 'reposition_entry_header_elements' );
function reposition_entry_header_elements() {
if ( is_singular( 'page' ) && ! is_page_template() ) {
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
add_action( 'genesis_after_header', 'genesis_entry_header_markup_open', 11 );
add_action( 'genesis_after_header', 'genesis_do_post_title', 12 );
add_action( 'genesis_after_header', 'genesis_entry_header_markup_close', 13 );
}
}
You can also use a conditional tag to exclude the blog page template in genesis.
Leave a Reply