- This topic has 11 replies, 2 voices, and was last updated 2 years, 6 months ago by Elvin.
-
AuthorPosts
-
September 13, 2021 at 6:27 pm #1929525Ken
Hi,
I found the following code in GP Docs:add_action( 'generate_after_entry_content', 'tu_cpt_footer_meta' ); function tu_cpt_footer_meta() { if ( is_singular( 'your-post-type' ) ) : ?> <footer class="entry-meta"> <?php generate_entry_meta(); ?> <?php generate_content_nav( 'nav-below' ); ?> </footer><!-- .entry-meta --> <?php endif; }
I then added my custom post types to get the following php and added it to my GP-Child-PHP at the bottom.
add_action( 'generate_after_entry_content', 'tu_cpt_footer_meta' ); function tu_cpt_footer_meta() { if ( is_singular( 'list_post','one_product','ten_product','five_product','how_to' ) ) : ?> <footer class="entry-meta"> <?php generate_entry_meta(); ?> <?php generate_content_nav( 'nav-below' ); ?> </footer><!-- .entry-meta --> <?php endif; }
Problem: it’s not working for 4 of the CPT, and I’m getting
TEST
TEST
For the ‘list_post’
Please see VDO and links below.
Thank you for your time and help.September 13, 2021 at 6:43 pm #1929530KenSorry, forgot to add, I’d be happy either way with
1. previous <-> next
OR
2. Previous CPT Name <-> Next CPT NameSeptember 13, 2021 at 8:25 pm #1929600ElvinStaffCustomer SupportHi Ken,
Any particular reason why you must add the navigation using a hook?
Consider using
Block Element - Post navigation
.With this, you can create your own template for post navigation for CPT using Block editor. You can set whatever text and styling to want to place on it.
September 13, 2021 at 8:50 pm #1929618KenElvin, ahh, didn’t think of Elements, it’s still pretty new to me.
Anyhow, sorry it’s still not working
> nothing for 4 of the 5 CPT
> test test for the list post
what I did:
> Elements > Element Type: Post Navigation > hook name; after_do_template_partDisplay Rules;
All Singular
Post > All Posts
List > All Lists (CPT)
Special Find > All Special Finds (CPT)
Collection > All Collections (CPT)
Trending > All Trending (CPT)
How to > All How to (CPT)Is there something else I need to do?
September 13, 2021 at 9:06 pm #1929632KenOkay, I forgot to delete the earlier code i used in the php. after doing that I selected a template from the Element Post Navigation > Element > Template. Still no navigation links below the CPT, works great for all other regular WP Posts.
September 13, 2021 at 9:12 pm #1929635ElvinStaffCustomer SupportElvin, ahh, didn’t think of Elements, it’s still pretty new to me.
You’re missing out. It’s a good thing to learn.
Here’s an example. https://share.getcloudapp.com/rRubmE7K
You can completely skip that PHP snippet if you do this. 😀
September 13, 2021 at 9:16 pm #1929639KenHowever it’s still not working. Can’t figure out what’s wrong.
Sending a link to the “special_find” (one product cpt)September 14, 2021 at 1:56 am #1929828ElvinStaffCustomer SupportAre you using a child theme template for this CPT? (ex. content-special_find.php)
The block element should work as is.
see this example post – https://dev-generate-press.pantheonsite.io/?movies=veritatis-velit-quia-inventore
It’s a CPT “movies”. On the bottom of the post, you’ll see a styled post navigation. This is done w/ Block ELement – Post navigation with the display rule and other settings shown here – https://share.getcloudapp.com/rRubmE7K
No codes required. On a clean GeneratePress install (no child theme template for movies CPT)
You can let us have backend access if you need help in checking things. You can use the private information text field for the details. 😀
September 14, 2021 at 2:02 am #1929835KenHi Elvin,
Yes I think so. I using GP Child theme and my coach helped me set up the CPT.
Boy, I’d sure appreciate if you have the time to check it out.It’s a temporary, 7 days, link to my dashboard.
September 14, 2021 at 2:08 am #1929842KenAlso, yes, I set the “display rules” for the regular post and all FIVE CPT. Only the regular posts show the Element is working, but the Element is not working with the 5-CPT that I selected under “display rules”
am I forgetting something?
September 14, 2021 at 7:32 pm #1930801KenProblem is solved!
Solution: I’m changing all my Custom Post Types to regular WP Posts. Fortunately there’s not that many to change and redirect. \(*<>*)/I’m spending too much time fiddling with these CPT and taking your valuable time as well–not good.
I’m deeply grateful for all the help you have given me and getting me started with using Elements. Wow!Not all is lost. My Coach provided folks who don’t have the CPT with HTML code that we could use with Gute Blocks that gives the same result as the custom post types.
Again, thank you so much for your help over the past month. I hope I can sort out any future problems on my own and if not, only then come here for the “Best Theme Support on This Side of the Internet Galaxy!” ٩( ᐛ )و
September 14, 2021 at 8:01 pm #1930828ElvinStaffCustomer SupportThanks for letting us know. Glad you got it sorted. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.