Site logo

Archived topic

Duplication of header on blog archive

10 replies · Started by Dan on January 3, 2019

Viewing posts 1–11 of 11

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;
}

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.

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 :)

This archived topic is closed to new replies.