- I developed a WP theme built on Roots/Sage.
- I have a custom post type "Projects."
- Within projects, I've registered a taxonomy for categories (projects_category) and applied a rewrite
('slug' => 'projects/projects-category', 'with_front' => false). - Some categories have children, most do not
- Within content.single-projects.php I'd like to include links to navigate to the previous/next project(post) within the current parent category.
I've tried the following, which displays nothing:
<?php previous_post_link( '%link', 'Previous Project', TRUE ); ?>
<?php next_post_link( '%link', 'Next Project', TRUE ); ?>
I've removed "TRUE" parameter. Post links then showed, and they included results for the entire "Projects" custom post type, not the current category.
After many hours of searching I've come to the conclusion more code is required. I'm under the impression
- an array needs to be created containing all results for "projects" custom post type.
- the current category needs to be identified and assigned a variable,
- loop through the array to identify posts within the current category,
- identify the current post's position within the result
- display posts adjacent to current post.
I have no idea where to start. Any assistance is greatly appreciated. Thank you.