Hello, I am trying to sort posts on a page by their custom tags. Sounds easy…but failing. This may be hard to explain but I will try. Anyway, the site has a Learning Center called CORPAK University so I created a CPT called corpaku.
Within that CPT I have several custom categories which are basically products we offers instruction on.
I created a template called taxonomy-corpaku.php This works great. When a user chooses the category page from the category menu they see the posts specifically for that Category (Product).
The problem that has stumped me is this:
I would like the posts to be organized on the page based on their custom tags. The posts are tagged either video or resource link. The videos appear in one section and the resource links should appear below in a differently styled section.
I am trying to do this by modifying multiple loops. but when I modify the loop to only display posts with video tag, it shows all posts from all categories with the video tag. i.e. it stops sorting by the original category of that page.
Ive tried for hours on all sorts of ways like changing parameters like this:
$args = array( 'post_type' => 'corpaku', 'corpaku_tag' => 'u-video', ); $the_video = new WP_Query( $args );
My last attempt was adding this line of code above the loop:
<?php $the_video = new WP_Query( array( 'corpaku_tag' => 'u-video' ) ); ?>
Is there a different way to do this? Trying to avoid having to create a ton of templates for each category. This is kind of advanced for a newbie so any help will be greatly appreciated. Thanks