- This topic has 16 replies, 3 voices, and was last updated 4 months ago by
Leo.
-
AuthorPosts
-
September 16, 2020 at 8:17 am #1445939
Olaniyi
Hi, How can I exclude multiple posts or a category from the related posts section; <nav id=”nav-below” class=”post-navigation”>
https://www.dropbox.com/s/42u60ovytfp64gm/2020-09-16%2016_15_31-Window.png?dl=0
September 16, 2020 at 8:30 am #1445960Leo
StaffCustomer SupportHi there,
Would something like this help?
https://docs.generatepress.com/article/generate_category_post_navigation/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 16, 2020 at 8:32 am #1445967Olaniyi
Yes, it should solve the problem.
September 16, 2020 at 8:33 am #1445969Leo
StaffCustomer SupportGlad to hear π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 16, 2020 at 9:10 am #1446024Olaniyi
Hi, Can you help with a sample code, struggling to solve it by myself.
September 16, 2020 at 9:18 am #1446032Leo
StaffCustomer SupportTry this:
add_filter( 'generate_category_post_navigation', '__return_true' );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 16, 2020 at 9:19 am #1446036Olaniyi
I got this part, the code I was asking for:
If I want this to work for a specific category rather than the whole website.
September 16, 2020 at 9:29 am #1446044Leo
StaffCustomer SupportTry this:
add_action( 'wp', 'lh_category_navigation' ); function lh_category_navigation() { if ( is_category( 'CATEGORY NAME' ) ) { add_filter( 'generate_category_post_navigation', '__return_true' ); } }
https://codex.wordpress.org/Conditional_Tags#A_Category_Page
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 16, 2020 at 9:34 am #1446055Olaniyi
This works, Thanks!
September 16, 2020 at 9:35 am #1446063Leo
StaffCustomer SupportNo problem π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 18, 2020 at 1:25 pm #1449213Olaniyi
Hello, Is it possible to prevent some specific posts from showing in the post navigation? For example, if I have some posts unsuitable for kids, and I don’t want them to show under any post navigation, how would I exclude these posts?
September 18, 2020 at 1:38 pm #1449229Elvin Customer Support
Hi,
Consider creating an R-18 category for posts that are not suitable for kids/minors.
You can then exclude that R-18 category the same way you’ve excluded the other categories.
A wise man once said:
"Have you cleared your cache?"September 18, 2020 at 2:03 pm #1449257Olaniyi
Yeah, that would work but it is not ideal in the current situation, which is why I reopened the topic.
Is there any post specific situation, maybe excluding with post ID, something like that?
September 18, 2020 at 2:09 pm #1449264Leo
StaffCustomer SupportIt’s pretty complicated to modify the WordPress posts loop like that.
A plugin like WP Show Posts should help:
https://en-ca.wordpress.org/plugins/wp-show-posts/Then you can use the exclusion option:
https://docs.wpshowposts.com/article/more-settings-overview/#exclude-post-idsDocumentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 18, 2020 at 2:17 pm #1449276Olaniyi
Alright, I will keep at it, thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.