Loopers: Show only values with specific fields

Hiya, I would like some help if possible please.

First question, is it possible to pull json data from a single place in WordPress? (Something similar to Global CSS or JS) Instead of copy / pasting locally / per page? - I have a long list of items with different sets of information that are combined, and I only need to pull and display things that are related to a page.

So second question, as mentioned above, I have a long list of items, but I need to filter and display only items with specified fields only. For example, below I have 5x lists, and on page A I would like to display items only with country code “GB” and on page B I would like to only display items with country code “FR” (of course I understand I would need to copy json into second page)

     {
        "Name": "London",
        "Country": "GB",
    },
    {
        "Name": "Paris",
        "Country": "FR",
    },
    {
        "Name": "London",
        "Country": "GB",
    },
    {
        "Name": "Paris",
        "Country": "FR",
    },
    {
        "Name": "London",
        "Country": "GB",
    }

Any help is much appreciated

Hello @rafalkukla,

Thanks for writing to us.

Regretfully there is no option at the moment. It would require custom development. I would suggest you contact a developer who can assist you with your concern. or you can subscribe to One where customization questions are answered. Please note that we don’t provide custom development support. It is out of the support scope.

Thanks for understanding

Thanks for your comment, perhaps this can be implemented as tag based output in the future of PRO?

Hello @rafalkukla,

I was able to accomplish something very similar to what you are asking using ACF Options Page:


This will allow you to have an ACF repeater field on this options page which you will be able to pull through from any page on your website.

Then with your second option, you should then be able to set a condition to the consumed element to only display those items that have a field on GB or FR. ie. {{dc:acf:option_field field="country"}} is GB

I think this should work as I’ve been able to do something very similar on a recent website.

Hopefully, this works.

Hey Rafal,

Please check out the bundled plugin: ACF Pro.

@Maratopia_Digital:
Thanks for chiming in!

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