• I have spent a fair amount of time on the forums here, and I know where most of the answer come from… so to those that give of their free time, thank you. Do you think it would be possible for those that are using this to post working examples, rather than posting things that don’t work? I think it would be immensely useful…

    I am working on a site, and while I think this plugin can provide the necessary mechanism for looping through the posts and filtering to the correct ones that match the criteria, I am having a hard time getting it to work – Basically, I have a series of conditions that must be true and if all are true display the related posts:

    This seems to get the first right but not the rest –
    [if field=ABCD]
    [pass fields=YY,ZZ,AA,BB,CC,DD]
    [loop type=sometype
    field=xx compare=”>=” value={YY}
    field=ab compare=”>=” value={ZZ}
    field=cd compare=”like” value={AA}
    ]
    [field title-link]
    [/loop]
    [/pass]

    This returns results where xx>=YY but stops after that comparison. SO ab>=ZZ doesn’t process.

    I could use some examples of what other people have done. I have tried nesting if’s within the loop and that hasn’t helped either….

    [if field=ABCD]

    [pass fields=YY,ZZ,AA,BB,CC,DD]

    [loop type=sometype]
    [-if field=xx compare=”>=” value_2={YY}]
    [–if field=ab compare=”>=” value_3={ZZ}]
    [—if field=cd compare=”like” value_4={AA}]
    (NOTE THAT IT SEEMED TO REQUIRE ONLY VALUE TO HAVE _# IN ORDER TO WORK??)

    [field title-link]
    [/—if]
    [/–if]
    [/-if]

    [/loop]
    [/pass]
    [/if]

    Should I be approaching this differently? I have an entire series of conditions all of which must be true in order to return a result… What am I missing? I could use some advice ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dmunaretto

    (@dmunaretto)

    Here is a sample of passing a field from the current page to query a custom post type of agent and return details about the agent that I am using.

    [pass field=real_user] NOTE: THIS IS THE FIELD FROM CURRENT POST
    Type:
    [loop type=real_people id={FIELD}] (THIS SAYS LOOK AT THE POST TYPE REAL PEOPLE FOR VALUE IN REAL USER FIELD THAT WAS PASSED)
    [content type=agent field=user_type] (THIS SAYS SHOW CONTENT FROM AGENT FIELD USER_TYPE
    [/loop]
    [/pass]

    Thread Starter dmunaretto

    (@dmunaretto)

    OK I’ve spent all day testing this, I can get up to field_4 compare_4 value_4 to work. After that it doesn’t appear to work — is there a limit on the number of compares you can filter on?

    Thread Starter dmunaretto

    (@dmunaretto)

    Here is my code:

    [if field=acf_property_type value=”Farm”]
    [pass fields=barn_size,barn_stalls,barn_loft,barn_hay,city]
    [loop type=property
    field=acf_property_type value=”Barn”
    field_2=”x_max_barn_size” compare_2=”>=” value_2='{BARN_SIZE}’
    field_3=”x_barn_stalls” compare_3=”>=” value_3='{BARN_STALLS}’
    field_4=”x_barn_loft” compare_4=”>=” value_4='{BARN_LOFT}’
    [note] Any fields after field_4 don’t appear to work [/note]
    field_5=”x_barn_hay” compare_5=”>=” value_5={BARN_HAY}
    field_6=”x_city” compare_6=”=” value_6={CITY}]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘More Complex Queries’ is closed to new replies.