Community Forums › Forums › Archived Forums › General Discussion › How to disable pagination
Tagged: archive pagination
- This topic has 13 replies, 3 voices, and was last updated 7 years, 3 months ago by
jimbo5.
-
AuthorPosts
-
September 11, 2018 at 2:18 am #223122
nicole2014
MemberI just noticed that on all pages (not posts) I have many versions of the same page under site.com/page/1 and I can substitute any number and it will still show as a new URL with the same content.
I would like to disable pagination and add a 301 to the same page with no page/numberAny help will be much appreciated.
Thanks!
http://creativecertificates.comSeptember 11, 2018 at 7:56 am #223130Brad Dalton
ParticipantThis code may still work https://gist.github.com/braddalton/5030437
It removes the pagination from archives, not the single post navigation.
Seems you also need code to add a 301 redirect
October 19, 2018 at 9:04 am #223861jimbo5
ParticipantHi, I´m having the same problem. I´ve been trying to remove the pagination from the archives page with no luck.
I put
remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
before the closing genesis();
in /wp-content/themes/genesis/page_archive.php
but is not working, the pagination is still there.
The URL with the problem is https://www.lagrimasartificiales.net/informacion/
October 19, 2018 at 9:21 am #223862Brad Dalton
ParticipantNever edit genesis files.
Add the code to a archive.php file in your child themes or use it in functions.php with a hook and conditional tag.
October 19, 2018 at 9:31 am #223863jimbo5
ParticipantMy child is Executive Pro and I can´t find the archive.php file there
October 19, 2018 at 9:41 am #223864Brad Dalton
ParticipantOctober 19, 2018 at 10:12 am #223865jimbo5
Participant?‘? Thank you very much 🙂
Now the problem is that the page only shows 6 posts of the category archive 🙁
October 19, 2018 at 10:38 am #223867Brad Dalton
ParticipantYes, You can change that in the Genesis > Theme Settings > Content Archive settings
Or
Using code like pre_get_posts with the posts per page parameter
October 19, 2018 at 10:45 am #223868jimbo5
ParticipantI´ve already got it in 50 posts.
October 19, 2018 at 10:50 am #223869jimbo5
ParticipantSomething like this?
<?php
add_action('pre_get_posts', 'filter_press_tax');function filter_press_tax( $query ){
if( $query->is_tax('press') && $query->has_term('press')):
$query->set('posts_per_page', 20);
return;
endif;
}
?>October 19, 2018 at 11:08 am #223870Brad Dalton
ParticipantOctober 19, 2018 at 12:16 pm #223873jimbo5
ParticipantYes! I´ve used yours and it´s working perfectly.
That you very much for your help 🙂
By the way, your website is veeeery useful 🙂 🙂
October 19, 2018 at 12:39 pm #223874jimbo5
ParticipantNo, is not working xDDDD
October 19, 2018 at 12:44 pm #223875jimbo5
ParticipantYes, it was the caché, sorry 😉
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.