Site logo

Archived topic

Want to disable pagination in homepage

11 replies · Started by John on January 29, 2020

Viewing posts 1–12 of 12

Hello

I am using tasty but in my homepage showing pagination. screenshot https://prnt.sc/quofn9

How can I disable it?

Thanks

Hi there,

We could certainly do that but how can a user get to the second page without the pagination?

Let me know :)

Google can treat as duplicate content second or later archive page.

Pagination is important for category page but in homepage I don't want it.

Showing 5 post in homepage is enough for me.

Note - I only want to disable pagination from homepage not category page

Try this CSS:

.home.blog .paging-navigation {
    display: none;
}

Its just hide from front end but code is still there. Is there anyway to disable instead hide by CSS?

Gone through the ref page but Its hard to understand for me because I am not familiar with too much code

Try this code:

function wpdocs_five_posts_on_homepage( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
        $query->set( 'posts_per_page', 5 );
    }
}
add_action( 'pre_get_posts', 'wpdocs_five_posts_on_homepage' );

tried and showing 5 posts in homepage but pagination still there.

This archived topic is closed to new replies.