Archived topic
Move Archive Title + Description To Below Header
6 replies · Started by Hftt on January 18, 2016
Hi Tom
How are you?
Could you please show me how to move "Archive Title" and "Archive Description" from inside content container to below header area (generate_after_header)?
Thanks you very much!
Great question!
Currently, this is very hard to do.
However, I just made it so in the next update of GP, you'll be able to do this with a simple piece of PHP.
I'll keep this unresolved and will come back once the new version is released to give you the code :)
Thank you so much!
That will be wonderful. Please, please update it. I really couldn't wait.
Hi Tom
I updated GP to latest version 1.3.24. Can I move "Archive Title + Description" to "Below Header" in 1.3.24?
Thanks much!
Hi Paris,
Awesome, let's give it a try:
add_action( 'after_setup_theme','generate_remove_archive_titles' );
function generate_remove_archive_titles()
{
remove_action( 'generate_archive_title','generate_archive_title' );
}
add_action( 'generate_after_header','generate_add_archive_titles' );
function generate_add_archive_titles()
{
if ( ! is_archive() )
return;
?>
<div class="page-header">
<?php generate_archive_title(); ?>
</div>
<?php
}
Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/
Let me know how it works out - might need some tweaking :)
Tom,
Thank you so much for snippet. It does work! Beautifully.
I wrap "generate_archive_title" with "grid-container" and add one more css class to tweak styles.
Love GP and owe you a lot.
You're very welcome :)
