Archived topic
Custom post type
18 replies · Started by _blank on August 30, 2017
Hi guys
I'm using a custom post type to display a portfolio or work. This is separate to normal blog index.
You can see an example here.
http://be2.mackiedesigncompany.com/wp/work_slug/project-12/
My client would like to add some navigation. Similar the the bottom of the post seen here:
http://be2.mackiedesigncompany.com/wp/february/
Do you know how I might do that?
Thanks
Scott
Hi
I got the snippet below from the forum sometime back. Just replace "kundcase" with your custom post type
//Add pagination to custom post type
add_action( 'generate_after_entry_content', 'jam_custom_post_type_post_nav' );
function jam_custom_post_type_post_nav() {
if ( 'kundcase' == 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;
}
Hey thanks Jamal, I'll give it a go.
Regards
Scott
Awesome that worked! Cheers Jamal.
Scott
Hi Tom
Is there a way to either remove "folder icon & Work" from the custom post and just have the nav to previous projects.
http://be2.mackiedesigncompany.com/wp/work_slug/project-12/
Or What is the best way for me to customise the page for the work category? I just want to remove the side panel as this is part of the news section.
http://be2.mackiedesigncompany.com/wp/category/work/
Thanks
Scott
Hi there,
Try this:
add_action( 'after_setup_theme', 'tu_remove_cpt_cats' );
function tu_remove_cpt_cats() {
if ( 'your_post_type' == get_post_type() ) {
add_filter( 'generate_show_categories', '__return_false' );
}
}
Just update your_post_type to the name of your CPT :)
Hi Tom
Do I add this to snippets?
Thanks
Scott
Ah sorry, yes :)
Thanks Tom,
I've tried it here, but still have the "work" category.
http://be3.mackiedesigncompany.com/wp/work_slug/landmark-wholesale/
This is what I have in snippets.
add_action( 'after_setup_theme', 'tu_remove_cpt_cats' );
function tu_remove_cpt_cats() {
if ( 'work_slug' == get_post_type() ) {
add_filter( 'generate_show_categories', '__return_false' );
}
}
Thanks
Scott
Hmm.. Try switching after_setup_theme with wp.
Cool that worked.
What css class can I use to make the nav arrow and names bigger etc?
Thanks
Scott
Try Customizer > Typography > Primary Navigation.
Hi Leo
Thank you. That changes the main menu nav !
Scott
Hi Leo
It's the navigation items at the bottom of the post such as "Careway" that i would like to change.
http://be3.mackiedesigncompany.com/wp/work_slug/landmark-wholesale/
Thanks
Scott
I'm not seeing Careway? Are you referring to the menu in the footer widgets?