- This topic has 45 replies, 3 voices, and was last updated 5 years, 5 months ago by Tom.
-
AuthorPosts
-
September 16, 2018 at 1:22 pm #678728Eva
Hi,
I am using GPP for a site with a filterable portfolio. I used the Meta Box plugin to make a CPT and Content Views Pro to show the filterable portfolio. It seems to work fine. But I would like to display tags and navigation on the single portfolio pages and I can’t get it done… I think I might need to make a template for the single portfolio items. Any suggestions?
Thanks,
EvaSeptember 16, 2018 at 6:46 pm #678838TomLead DeveloperLead DeveloperHi Eva,
So are the single portfolio pages a custom post type?
If so, you could try something like this:
add_action( 'generate_after_content', function() { if ( is_singular( 'your-post-type-name' ) ) { the_posts_pagination(); } } );
Let me know ๐
September 17, 2018 at 1:59 am #678987EvaHi Tom,
Thanks for your prompt reply. Unfortunately this didn’t work… I made a custom post type for the portfolio items because there will be news items too. So, the single portfolio pages are a custom post type. But I didn’t make a special template to show the portfolio items, if that is what you mean. I am sorry for the confusion. Hope I managed to make myself clear, and you can help me resolve the problem.
I have another question about custom fields, but I will make a new topic.
Thanks again. Great support, as always!
EvaSeptember 17, 2018 at 10:33 am #679451TomLead DeveloperLead DeveloperHi there,
Did you replace
your-post-type-name
with the name of your custom post type? Templates themselves shouldn’t matter as long as the ID of the post type matches.September 17, 2018 at 12:44 pm #679556EvaHi Tom,
Yes I did, and I tried everything I could think of…
I used ‘project’ because: register_post_type( ‘project’, $args );
I also tried ‘Project’ and ‘Projecten KPG’ because: ‘label’ => esc_html__( ‘Projecten KPG’, ‘text-domain’ ),The strange thing is that I can change the featured image (on/off, size), but I can’t change anything in the Single Content.
Thanks!
September 17, 2018 at 8:28 pm #679758TomLead DeveloperLead Developerproject
should work.If you replace your function with the below, do you see the
testing
message?:add_action( 'generate_after_content', function() { if ( is_singular( 'your-post-type-name' ) ) { echo 'testing'; the_posts_pagination(); } } );
September 18, 2018 at 12:53 am #679846EvaHi Tom,
I have tried and yes, I do see ‘testing’ below the content of the post ๐
Hope you can tell me what to do the next.Thanks!
September 18, 2018 at 9:40 am #680360TomLead DeveloperLead DeveloperI just made a change to the code above, can you give it another shot?: https://generatepress.com/forums/topic/display-content-in-single-cpt/#post-678838
September 18, 2018 at 12:45 pm #680532EvaHi Tom,
Uhm… don’t think this works…
Fatal error: Call to undefined function the_post_pagination() in /…/…/….nl/wp-content/themes/generatepress_child/functions.php on line 86Sorry for all this…
Thanks again,
EvaSeptember 18, 2018 at 4:14 pm #680635DavidStaffCustomer SupportHi there,
can you double check the code you have added, Tom made an amend to the above. Note the undefined function is
the_post_pagination()
in Tom’s code it isthe_posts_pagination()
I would recopy and paste the code here:
https://generatepress.com/forums/topic/display-content-in-single-cpt/#post-679758
September 19, 2018 at 6:57 am #681101EvaHi David,
Thank you for your reply, but unfortunately this doesn’t work either…September 19, 2018 at 8:59 am #681319TomLead DeveloperLead DeveloperAh, sorry about that – typed the function wrong.
the_posts_pagination()
should be working, but it’s not outputting anything. Can re-add the original code that calls tothe_posts_pagination()
so I can inspect the code?September 19, 2018 at 10:24 am #681390EvaYep, just did. It’s now back to:
add_action( ‘generate_after_content’, function() {
if ( is_singular( ‘project’ ) ) {
the_posts_pagination();
}
} );
Just to make sure, in the Child: functions.php.I can make you a login, if you like..
Thanks!
September 19, 2018 at 10:14 pm #681799TomLead DeveloperLead DeveloperThis is super strange – some markup should at least be printed.
Do you have any other functions on the site?
Is the post navigation disabled in “Customize > Layout > Blog”? If so, what happens if you enable that option?
September 20, 2018 at 1:20 am #681864EvaI have another function and took it out to see what happens… nothing. Then I (de)activated some plugins: nothing.
I also enabled/disabled all options in the Blog layout… nothing.
Just to make sure: I added the function to the functions.php in the child theme. -
AuthorPosts
- You must be logged in to reply to this topic.