Archived topic
Duplication of header on blog archive
10 replies · Started by Dan on January 3, 2019
Hi
I noticed that the blog archive page is duplicating the page's title.
In every article section resides the post's H1 "entry-title" - "Latest News & Events"
https://www.campio-group.com/blog/
Any idea why this is happening?
Thanks!
Dan
Hi there,
Looks like it's being added via a Hook. Can you see which one it is? If so, what are the contents/location of it?
There is a 'Before Content' hook active:
<?php if ( is_home() ) : ?>
<div class="grid-container grid-parent">
<header class="entry-header">
<h1 itemprop="headline" class="entry-title">Latest News & Events</h1>
</header>
</div>
<?php endif; ?>
To be honest, I'm not sure why it's there.
Dan
and there is another filter in the functions.php file:
add_filter( 'get_the_archive_title', 'tu_adjust_archive_titles', 20 );
function tu_adjust_archive_titles( $title ) {
if ( is_tax() ) {
return single_tag_title( '', false );
}
// if ( is_category() ) {
// return 'Resource Type: ' . single_cat_title( '', false );
// }
return $title;
}
not sure why, but there is another duplicate blog archive page here:
https://www.campio-group.com/category/blog/
I moved the code into the 'Inside Content Container' hook and it stopped duplicating now.
I guess the 'Before Content' hook is before each post entry and not for the actual page.
Hi there,
yes the before_content is within the post content. This visual guide will help:
https://docs.generatepress.com/article/hooks-visual-guide/#archives
Thanks, any idea why this is happening?
https://generatepress.com/forums/topic/duplication-of-header-on-blog-archive/#post-772397
Dan
Those posts have a category of Blog (?)
Correct, should I remove them from that category?
Yep. You can then delete the category as its not required :)