Site logo

Archived topic

Posts in double

7 replies · Started by JOAQUIM GALANTE on May 14, 2020

Viewing posts 1–8 of 8

David i change messages with Tom and he can´t find solution can you solved the follow problem ?

When i pass the page 1 to page 2 the 4 last posts of the page 1 appear on top of page 2 again. Only happens on these pages. Have you a solution for this case ?

Hi there,

unfortunately i could not find a solution to that problem.

The alternative would require you to set specific posts to be displayed in the Hero Grid and then exclude them from the main blog.

No problem. Thanks

Sorry we couldn't be of more help.

To explain the alternative method.
You can create a new Post Category called featured for example.
Then edit the WP Show Post list being used in the Hero grid and select Taxonomy > Category > featured.

Now the grid will only display posts that you add to the Featured Category.

Then you can add this PHP Snippet to exclude that Category from your archives:

function exclude_category( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
        $query->set( 'cat', '-xx' );
    }
}
add_action( 'pre_get_posts', 'exclude_category' );

Change the xx to the Category ID

It means you have to manually update the Hero posts but will fix the issue of double posts

David the problem is not the grid, the grid is right.

The problem is the frontpage posts in page 1 the last 4 posts repeat in page 2.

Thanks

I know. The problem comes from the code your using to remove the first 4 posts from the main blog. It is that code that creates the problem on page 2.

The Category method won't have that problem

Thanks a lot David i will see if i can do it. Hug

You're welcome

This archived topic is closed to new replies.