Archived topic
Custom Navigation "Post-Nav” not rendering on Events pages
8 replies · Started by Neil on June 4, 2021
Hi,
I was wondering if you could take a look at the post-nav element that renders but does not display on my events pages or archives. I have the element set to display on entire site.
https://sticinterfaith.org/events/ is the generated events page
An event from this site:
https://sticinterfaith.org/event/third-reconstruction/
I am using post-nav on another site where it does render:
https://evafogelman.com/event/founders-of-the-second-generation-movement/
Thank you,
Neil
Hi Neil,
When this happens, check if there are any conflicts in location rules.
Could you take a screenshot of all your elements list?
Btw post navigation is only supposed to work in single post or single CPT, not archive pages.
Let me know :)
Hi Ying, Thanks for the fast response! I removed the screenshot.
I noticed that you are using a hook element for the post navigation, the code might not work with CPT.
I would recommend trying a block element - post navigation, it comes with some pre-designed templates and the dynamic feature should work for CPT as well.
Here's a demo video for your reference :)
https://docs.generatepress.com/article/block-element-post-navigation/
Thank you, I will try it in development first and let you know.
Keep us updated :)
Thanks!
Hi Ying,
I could not get the block or the hook I used to render on the Events post type. I switched my theme from my child theme to GP itself too. I also eliminated every other element to just have the one footer element post-nav.
post-nav renders correctly from my hook on pages and posts in this stripped down test environment.
Hi again,
When I added a second event (though I had many events in development) the php after post-nav started to render.
That is the only explanation I have though I did toggle events settings back and forth between gutenberg and non-gutenberg as well as flush the cache a bit and add events to the site-wide display.
I cannot explain why it is now performing as expected when displayed site-wide in addition to specifying the events cpt.
Yeah, it definitely sounds wreid. So the post nav hook works for the second event post type now when the location set to the entire site and the CPT itself?
Are there any differences between the first event and the second event in terms of settings?
Usually, the block element's dynamic feature should work for CPT.
Let me know :)