Home › Forums › Support › Want to disable pagination in homepage This topic has 11 replies, 2 voices, and was last updated 4 years, 2 months ago by Leo. Viewing 12 posts - 1 through 12 (of 12 total) Author Posts January 29, 2020 at 10:15 am #1148460 John Hello I am using tasty but in my homepage showing pagination. screenshot https://prnt.sc/quofn9 How can I disable it? Thanks January 29, 2020 at 10:20 am #1148466 LeoStaff Customer Support Hi there, We could certainly do that but how can a user get to the second page without the pagination? Let me know 🙂 January 29, 2020 at 10:37 am #1148478 John 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 January 29, 2020 at 10:40 am #1148481 LeoStaff Customer Support Try this CSS: .home.blog .paging-navigation { display: none; } January 29, 2020 at 10:43 am #1148485 John Its just hide from front end but code is still there. Is there anyway to disable instead hide by CSS? January 29, 2020 at 11:03 am #1148500 LeoStaff Customer Support We can try using this snippet to set the home page post number to 5: add_action( 'pre_get_posts', function( $query ) { if ( is_front_page() && is_home() ) { $query->set( 'posts_per_page', 5 ); } } ); Adding PHP: https://docs.generatepress.com/article/adding-php/ This is controlled by WordPress itself so more info here: https://developer.wordpress.org/reference/functions/query_posts/ January 29, 2020 at 11:11 am #1148508 John Tried the code via code snippet plugin. https://prnt.sc/qup8gm But unfortunately Its not work. January 29, 2020 at 11:17 am #1148514 LeoStaff Customer Support What about the example here? https://developer.wordpress.org/reference/functions/query_posts/ The snippet below “For example, on the homepage, you would normally see the latest 10 posts. If you want to show only 5 posts (and don’t care about pagination),” seems to be what you are after. January 29, 2020 at 11:25 am #1148521 John Gone through the ref page but Its hard to understand for me because I am not familiar with too much code January 29, 2020 at 11:27 am #1148528 LeoStaff Customer Support 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' ); January 29, 2020 at 11:31 am #1148538 John tried and showing 5 posts in homepage but pagination still there. January 29, 2020 at 11:44 am #1148553 LeoStaff Customer Support Ahh right. Unfortunately we don’t have a filter for that as it’s not really logical to remove the pagination under normal circumstances. You would need to create a child theme, copy post-meta.php in to the child theme folder and remove is_home() || from this line: https://github.com/tomusborne/generatepress/blob/7f9a2662f3388295407e96065fafe348b28a01b6/inc/structure/post-meta.php#L74 Author Posts Viewing 12 posts - 1 through 12 (of 12 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In