ACF shortcode nested in component parameter string

Hello @Daryl_Shaw,

Your query syntax becomes contradictory because;

  • category_name={name} will display post items that belong in that specific category name while
  • cat=-ID will display all post items except those that fall under that category ID.

For more query reference, please check the codex:

You may need to create something different or just use two separate and independent loopers.

Thanks.

Yes, because that is what I want to do: combining an include condition for a category, chosen by URL param:{{dc:url:param key=‘cat’ fallback='dc:param:cat_filter'}}(using the fallback entry given bei an ACF as initial default, if there is no URL param defined) with an exclude condition: but show only posts that are not also tagged with category XY.

Thanks for your link, it is certainly helpful for developers, but as a “user” I don’t understand how to turn this into a working query string for my purposes to paste into Cornerstone.

Hello @Daryl_Shaw,

The use of the dynamic content {{dc:url:param key=‘cat’ fallback='dc:param:cat_filter'}} will work in 6.2.0 beta 2 which is great as what @Charlie mentioned. The only problem is that if your query becomes category_name={name}&cat=-ID, you will have a conflict because WordPress cannot process that query. You can either have to return post items that belong to a category or display post items that do not belong to a particular category. With this query, it is no longer an issue with the theme or plugin. It is already between your query and how WordPress returns the query. It may even get into an infinite loop.

We would suggest that you decide what you want to display. If we go back and based the query in your original post which is this:
category_name={{dc:url:param key="cat" fallback={{dc:acf:user_field field="cat_default" user="1"}}}}&orderby={{dc:url:param key="order " fallback="rand"}}&posts_per_page=4

From what I understand in this query, you are trying to display post items that have a category name related to a particular user “1”. It got complicated because the current version does not allow nested dynamic content code. If you use the beta version and follow what @Charlie mentioned in his reply, that query should return something.

Thanks.

Ok, I see, this is important information. It’s not easy for me as a "user " to know such things or to know where to find simple and understandable information about that.
Then we stop this thread here, because my remaining question is then better suited as a new topic.
Thank you for the detailed treatment and thank you @charlie for integrating the fallback solution!

Hi @Daryl_Shaw,

You are most welcome.

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