• Resolved blakefosdick

    (@blakefosdick)


    I’m trying to get a page to display custom posts I created but only showing ones that contain a value from a checkbox field. The values are 1,2,or3. I’ve tried many variations of the loop short code and can’t seem to figure it out. Here are a few that I’ve tried:
    (4marks-product is the slugname of the custom posts type)
    [loop type=”4marks-product” value=”first”]
    [loop type=”4marks-product” value=”1″]
    also tried replacing the word value with the slug name of the checkbox field, ie:
    [loop type=”4marks-product” column-display=”1″]
    [loop type=”4marks-product” column-display=”first”]
    also tried
    [loop type=”4marks-product” field=”column-display” value=”1″]

    Nothing seems to get only the posts with the checbox of value 1 checked to display, rather all posts will display.
    Would very much appreciate your help and furthermore appreciate the work you’ve done building this great plugin.

    Thanks,

    Blake

    https://wordpress.org/plugins/custom-content-shortcode/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello, the checkbox query works like this:

    [loop type="4marks-product" checkbox="column-display" value="1"]

    There’s documentation under Settings -> Custom Content, in the section for the loop shortcode. I actually just made an update to the plugin, to extend this feature (to query by multiple values).

    Please let me know if that works for you.

    Thread Starter blakefosdick

    (@blakefosdick)

    Doesn’t seem to be working for me. It won’t display anything actually. I noticed that everything was displaying last time because I had an extra space before my end bracket.
    I tried changing the values of my checkboxes from numbers (1,2,3) to words (first, second, third) and no go.
    The only time I can get it to display anything is when I take off the checkbox option entirely and only have the loop type=”4marks-product”

    Plugin Author Eliot Akira

    (@miyarakira)

    Hmm, I believe either the field slug or value is not matching for some reason.

    Have you taken a look under Dashboard -> Content to see if the field slug for the checkbox is exactly the same as that specified in the loop shortcode?

    It could be that the checkbox values are stored in a different way depending on the plugin, and the loop shortcode isn’t processing it correctly. Are you using Advanced Custom Fields or another plugin to create the checkbox?

    Thread Starter blakefosdick

    (@blakefosdick)

    Thank-you! You were right, I’m using “Types” plugin to create the custom fields and the slug name it shows is different than what shows up in Dashboard->Content.

    Also I had the values at first,second,third and when I switched them back to 1,2,3 it started working!

    so a combination of using number values(which I wouldn’t think would matter) and most importantly using the right slug name.

    Thank you so much for helping me!

    Blake

    Plugin Author Eliot Akira

    (@miyarakira)

    Great, I’m glad to hear you solved it!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display Posts filtered by checkbox values’ is closed to new replies.