Grow your CSS skills. Land your dream job.

How to query a post based on meta data in wordpress

  • # March 15, 2011 at 11:15 pm

    I need to query posts by a custom field. Someone please help. I have no idea how to make this work.

    < ?php query_posts("meta('ReleaseDate')<=date(yyyy-mm-dd)") ?>

    # March 15, 2011 at 11:23 pm

    The date should be today’s date and the format of dvdReleaseDate is yyyy-mm-dd

    # March 16, 2011 at 10:43 am

    Here’s the code I’m working with….

    < ?php query_posts( 'meta_key=dvdReleaseDate&orderby=meta_value&meta_compare=>=&meta_value=’ . time() . ‘&order=ASC’ ); ?>

    However, it is not working properly. Please help.

    # March 16, 2011 at 10:49 am

    The dvdReleaseDate is saved as a custom field with the plug-in More Fields in the Date Format:

    “Date HTML5 input type, full functionality available in modern browsers. Alternative input: YYYY-mm-dd, i.e 2010-07-10″

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".