• Resolved Jennyfer37

    (@jennyfer37)


    Hi,
    I’ve used Display Posts to create a list of posts with a custom post type of Pre School Class.

    Now I’d like to create a page that only shows Pre School Class posts that have certain Custom Fields eg Class Day is set to Monday.

    I’ve tried using taxonomy and tax_term shortcode to achieve this but I can’t get it to show the correct posts.

    Can anyone help?

    [display-posts post_type=”preschoolclass” include_excerpt=”true” excerpt_length=”20″ image_size=”thumbnail” wrapper=”div” wrapper_class=”display-posts-listing image-left” taxonomy=”classday” tax_term=”Monday”]

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    You can use the meta_key and meta_value parameters to perform meta queries.

    Ex: [display-posts post_type=”preschoolclass” include_excerpt=”true” excerpt_length=”20″ image_size=”thumbnail” wrapper=”div” wrapper_class=”display-posts-listing image-left” meta_key=”classday” meta_value=”Monday”]

    Thread Starter Jennyfer37

    (@jennyfer37)

    Hi,
    I’m trying to move over to using my Custom Fields created with ACF but using the above code returns no results.

    This is my code:

    [display-posts post_type=”preschoolclass” meta_key=”class_days” meta_value=”Wednesday” include_excerpt=”true” excerpt_length=”20″ image_size=”thumbnail” wrapper=”div” wrapper_class=”display-posts-listing image-left” order=”ASC” orderby=”title” posts_per_page=”-1″]

    The field is called “class_days” and it is a checkbox field.

    Any thoughts about where I’m going wrong?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Filtering posts by Custom Field’ is closed to new replies.