Filter posts by category with buttons (2)

Regarding my staging site and page: https://retailinflfstg.wpengine.com/news/

Good day. I am hoping this is within the scope of your support and you can provide me with the solution to this(?).

I need to build an Archive Layout that displays WordPress Posts of two specific Categories- “news-z-suite” and “news-ceo-forum”. There will be three buttons on the page. One button to filter and display the news-z-suite posts, one button to filter and display the news-ceo-posts and a third button to display “All”

I believe what I am trying to achieve is the same thing that Rachel posted on the forum (link Dynamically filter looper content with terms buttons). I have studied this post, along with all of the other posts ThemeCo support referred Rachel to. I have also watched Josh Donnely’s video “Easily setup custom sorting…” and thus far I have had no success.

In Rachel’s post, ThemeCo provided the solution below.
Capture_query

I tried editing this query to replace the text in the string with text I believed would be applicable to my Looper Provider, but I do not get the correct results. I highlighted in yellow to show you the text I edited in the query. Even if this worked, it only seems to address one of the two categories, so I’m not sure how the 2nd category, or “All” would be displayed.

Hopefully, I am near the right solution, but any assistance you can provide will be appreciated. Generating the right query and passing the url param is a wee bit above my level right now, but I’m trying to learn more.

Best,
Michael

Hey Michael,

Thanks for reaching out!

In order for us to help you with your issue, we need to check and investigate first on your setup. That being said, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Thank you.

Hello @mcaravaglia,

What you are trying to do will not work with Archive layouts. Be advised that Archive layouts do not need a Looper Provider. You only need to have a Looper Consumer to make it work. Filtering the post items will only work on normal pages. At the moment, you should be linking your buttons to the following links in the secure note below.

Thanks.

1 Like

Thank you. I’m confused about one thing.

I assume this page does not need the Looper Provider, because I am using the standard WP-Posts and the condition is set “When Blog is being viewed”. If, however, I am using a CPT (Custom Post Type) and I don’t use a Looper Provider, it will not find the correct content.

Please confirm this is correct. Thank you.

Hello @mcaravaglia,

The archive layout will still find and display the contents dynamically. You just have to assign the archive layout to your custom post type like this:

Hope this helps.

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