Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

How to evaluate taxonomy of post included in many-to-many relationship

$
0
0

For ease of navigation, my site has a many-to-many relationship between product groups, applications and solutions. So web editors can select which 'applications' and 'solutions' are related to each product group, and vice versa, using drop-downs in the product edit page.

A CPT, 'System Associations' is used to create a record for each association between a product group and a post, so that in the sidebar of a product group we can list the applications and the solutions (separately) with links, for the displayed product groups.

I therefore want 2 views, one called 'assoc applications' and the other called 'assoc solutions' Each one should list the posts accordingly for the current product group. Both of these are simple post-type entries differentiated only by the category they belong to – "Applications" and "Solutions".

So the question is, how do I query and evaluate the category of the post itself, when my view is looping through 'System Associations" and not "Posts".

This is my existing code ( evaluation doesn't work):

 
<wpv-loop>
          [wpv-if evaluate="has_term('Applications','category',null) = '1'"]
          <div class="assocblock">
          [types field="navigation-icon" size="product-sidebar-thumb" align="left" id="$post"][/types] [wpv-post-link id="$post"]</div><p>
          [/wpv-if]
		</wpv-loop>

This is trying to check whether the post is a member of the Applications category before listing it. But it can't check it because its not querying the post itself but merely the listing of it in the many-to-many CPT.

What syntax should I use to query the category of the post itself, please? I tried this, but it didn't work either:

  [wpv-if evaluate="has_term('Applications','category',null) = '1'" id="$post"]

Thanks
Tim


Viewing all articles
Browse latest Browse all 20145

Trending Articles