Related articles in single blog posts

We have a use case where our blog articles use several categories (1-4 items). However, there will always be 1 specific category chosen from a group of 6. The categories are not nested.

For instance:
Blog 1 -|Get Wise|Faith, Growth, Bible|
Blog 2 -|Get Wise|Worship, Inspiration, Purpose|
Blog 3 -|Get Focused|Bible, Growth, Inspiration|
Blog 4 -|Get Focused|Bible, Growth, Inspiration|
Blog 5 -|Get Focused|Leadership, Culture, Growth, Purpose|

I suppose I can build a section for each of these main “Get …” categories and use conditions to turn them on/off based on the presence of the specific “Get…” category for that specific post. So so in order to do this would I need to create a custom looper based on the categories in that post?

I know that I can do a custom query:
category_name={{dc:term:slug}}&post_type=post&posts_per_page=3&offset=0&ignore_sticky_posts=1&post__not_in%5B0%5D={{dc:post:id}}

But how would I extract the IDs of all the categories in a post and verify that a specific ID is in the post with multiple categories?

Hello @designerken,

Thanks for writing in!

You will have to run the Looper Provider Current Terms first and then nest a Looper Provider Query String in it. This is the only way you can get the Category IDs.

Looper Provider Current terms
   Looper Consumer
      Looper Provider Query String
          Looper Consumer 

Best Regards.

Hello @ruenel,

That layout makes sense with the looper providers and consumers.

I think I found an easier solution. I created a row for each of the terms that I wanted to display the specific category of 3 posts using the custom query in my original post. replacing {{dc:term:slug}} with the actual slug.

Then I used a condition of each row to use Post (has term) and selected the corresponding term for that row. All seems to work for now.

Hi @designerken,

Glad to know that everything is working now.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.