Archived topic
page header title css help
10 replies · Started by johnaps on January 4, 2022
Hello!
i would like to position my page title on the start of the left sidebar and not on the start of the masonry-container.
this will give you a picture
https://ibb.co/2qVjZjg
whatever css i came up with was faulty...
Have you stumbled on this before? If so can you please help me out, with the correct way to do this?
If css isnt the best option, is there a way to output the
<header class="page-header" aria-label="Page">
outside and before the <div class="site-content" id="content">?
Hi John,
Try this PHP snippet:
add_action( 'after_setup_theme', function() {
remove_action( 'generate_archive_title', 'generate_archive_title' );
} );
add_action ('generate_inside_site_container', 'generate_archive_title');
Thank you very much!!!
No problem :)
Hello again!
I think there are some further issues i need help with the above solution!
In my search results pages the page-header is added 2 times
https://thefinterest.kinsta.cloud/?s=j
In the new position set and in the old one.
Also the new header in search results page is showing "Archives" instead of "Search Results".
And lastly in my homepage a new header appeared with the name "archives", which wasnt there before and isnt necessary i believe.
https://thefinterest.kinsta.cloud/
Can you help me fix this?
Also in my posts the header appears a second time before content and i dont want it...
https://thefinterest.kinsta.cloud/p/uncategorized/asjalska/
I see, try this one so that the archive title will only be removed and re-added to the archive pages:
add_action( 'after_setup_theme', function() {
remove_action( 'generate_archive_title', 'generate_archive_title' );
} );
add_action ('wp', function() {
if ( is_archive() ) {
add_action ('generate_inside_site_container', 'generate_archive_title');
}
} );
it is almost perfect!
i want to apply that in search results pages also
example: https://thefinterest.kinsta.cloud/?s=df
i want the header above site-content in search results as well
Hmm give David's solution here a shot:
https://generatepress.com/forums/topic/page-header-on-search-page/#post-1056795
okay thank you, that worked, but i added it as a hook not a header!! :)
Glad it worked :)