Archived topic
Move header above columns on category pages
3 replies · Started by Ryan on December 18, 2019
On the category pages on my blog, I have a two column layout. It would be really nice if I could move the <header class="page-header"> section to the top of the page outside of the columns. So the two column layout would only appear under the page header. In other words I need to move it first in the #content div. I know I could do this by finding the template file and editing it in my child theme. But I thought maybe you could give me a better way that wouldn't cause problems if you make file changes in the future. Thanks for the help!
Hi there,
There's a new hook in GP 2.4.0 we can use. Let's try this:
add_action( 'wp', function() {
remove_action( 'generate_archive_title', 'generate_archive_title' );
if ( is_archive() ) {
add_action( 'generate_inside_site_container', 'generate_archive_title' );
}
} );
Awesome, exactly what I wanted and so much easier then searching through template files like I started doing. I'm glad I asked!
Glad I could help! :)