Forums Forums Search & Filter Pro Query Custom Post by ACF Dropdown Value

Viewing 10 posts - 1 through 10 (of 19 total)
  • Anonymous
    #76869

    I’m stuck and I’m not sure if the plugin will allow this. I have custom post types which include Advanced Custom Field dropdowns to select a US State and counties within each state. On the front end, the custom posts will show info that has not been assigned a state or county (i.e. at the national level). I want to include two dropdown lists so that a visitor can add to the custom post content by just the state or also by county, depending on the state selected. I want to use AJAX so the page does not refresh.

    Trevor
    #76951

    The user is adding data to your posts in the front end and saving it?

    Anonymous
    #77068

    No. A visitor to the site should be able to click one dropdown to pick a state. Posts tagged by that state with an advanced custom field dropdown should then display on the screen. The visitor should also be able to click a second dropdown to select a county from that state in order to display more posts specific to that county.

    Trevor
    #77270

    As long as you have Auto Count switched on (both boxes) and in each form field you have checked ON Hide Empty, this should work.

    Anonymous
    #77331

    I had those settings. I thought it wasn’t working because the dropdown was displaying as this little sliver of a box, but I realized CSS was the answer for that.

    The problem I have though, is that the results show all posts by default. Is it possible to display relevant results only if the corresponding dropdown option is selected? Or in other terms, can I disable the default selection, All Items, so that all items do not display by default?

    Trevor
    #77355

    IF you are using the Shortcode display method, you could add a condition to show alternative content when the filter has not been use, BUT, how you would show what you want I do not know.

    Anonymous
    #77477

    I’m struggling to figure out how to do that. Maybe I’m missing it, but I cannot find documentation on using conditions. I am using the shortcode display method. Would you please explain how to show alternative content when the filter has not been used?

    I have my theme displaying what I want by default, so that’s not a problem. I just don’t want the filter to generate any content unless an option has been selected.

    Sorry to keep bothering you!

    Trevor
    #77495

    Sure. In the code snippet in the linked example post, the form ID number is included (255). You need to change that for the ID number of your form (for example you can see the ID number in the shortcode). See this post.

    Where it says echo '<div>Nothing to see here folks!</div>'; is where you put whatever you need to show the posts that you want. I do not know how to do that. There may be a function in your theme that you can call. Most likely you need to look at your theme template files, or ask your theme author.

    Anonymous
    #77846

    Ok, I got that much to work the way I want. Thanks for the info. I thought when you said to add a condition that I was supposed to do so from the Post Meta tab within the plugin.

    Now I’m struggling to figure out how to get the second dropdown to populate based on the selection of the first dropdown.

    Trevor
    #77851
Viewing 10 posts - 1 through 10 (of 19 total)