- This topic has 21 replies, 3 voices, and was last updated 6 months, 3 weeks ago by
David.
-
AuthorPosts
-
May 30, 2017 at 9:44 am #326195
wekhter
How do you get the built-in generatepress next/previous post links to work on custom post types?
GeneratePress 1.3.46GP Premium 1.3May 30, 2017 at 7:03 pm #326390Tom
Lead DeveloperLead DeveloperTry this:
add_action( 'generate_after_entry_content', 'tu_custom_post_type_post_nav' ); function tu_custom_post_type_post_nav() { if ( 'my-post-type' == get_post_type() ) : ?> <footer class="entry-meta"> <?php generate_entry_meta(); ?> <?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?> </footer><!-- .entry-meta --> <?php endif; }
Adding PHP: https://docs.generatepress.com/article/adding-php/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 31, 2017 at 4:54 pm #326844wekhter
Thanks! Another question–is there something I can do to remove next/previous on regular posts, but keep them on my CPT?Also, I found snippets on the forum to edit the text that appears before the next/previous links, but I’d like that text to appear inside the links (so for instance the word “previous” being part of the link instead of being before the link).Nevermind, figured out what I was doing wrong. Will the ability to have more control over page nav be added to GP Premium anytime soon?
June 1, 2017 at 12:06 am #327023Tom
Lead DeveloperLead DeveloperWhat kind of control are you looking for?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 1, 2017 at 3:38 pm #327409wekhter
@Tom Basic sorts of things:
1) Ability to disable next/previous on posts (an option in the blog extension?)
2) Font size
3) Change the text that appears before links
4) Alignment (so for instance, instead of having both left aligned, left align previous and right align next, or center align both on the same line)
June 1, 2017 at 7:17 pm #327481Tom
Lead DeveloperLead DeveloperNoted. Thanks! π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 26, 2017 at 9:28 am #457283Gwen
Hi,
I’ve added the following to my child theme’s functions.php so there will be next/previous links on “staff” CPT posts. However, all that is rendering on the front-end is
<footer class=”entry-meta”> </footer>Have I missed a step along the way? Thank you!
—–
add_action( 'generate_after_entry_content', 'tu_custom_post_type_post_nav' ); function tu_custom_post_type_post_nav() { if ( 'staff' == get_post_type() ) : ?> <footer class="entry-meta"> <?php generate_entry_meta(); ?> <?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?> </footer><!-- .entry-meta --> <?php endif; }
December 26, 2017 at 7:40 pm #457513Tom
Lead DeveloperLead DeveloperGive this a shot instead:
add_action( 'generate_after_entry_content', 'tu_custom_post_type_post_nav' ); function tu_custom_post_type_post_nav() { if ( 'staff' == get_post_type() ) : ?> <footer class="entry-meta"> <?php generate_content_nav( 'nav-below' ); ?> </footer><!-- .entry-meta --> <?php endif; }
Let me know π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 28, 2017 at 2:05 pm #458811Gwen
Thanks so much, Tom — that works!!
December 28, 2017 at 10:22 pm #459000Tom
Lead DeveloperLead DeveloperYou’re welcome π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentSeptember 2, 2019 at 1:28 am #998888Matt
Hi, How do I remove/disable Next/Previous link at footer? I just upgraded to Pro, but I do not see anything to disable Next/Previous link. Thanks!
September 2, 2019 at 2:24 am #998918David
StaffCustomer SupportHi there,
you can disable the Display post navigation in Customizer > Layout > Blog:
https://docs.generatepress.com/article/blog-content-layout/#single
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 2, 2019 at 3:09 am #998951Matt
Hi David, thanks. Found another way, much easier posted by jmarc:
CSS >>>
.nav-links { display: none; }
September 2, 2019 at 3:13 am #998953David
StaffCustomer SupportThat simply hides the nav, doesn’t remove the code from the markup. I am not sure why unchecking a box in the customizer would be more complicated then adding CSS. But if it works for you, then great.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 2, 2019 at 3:26 am #998968Matt
Tried all that before. Didn’t work. I was only trying to remove the Previous/Next links just above footer.
-
AuthorPosts
- You must be logged in to reply to this topic.