Support » Plugins and Hacks » WordPress Query Posts Meta Compare by Variable

  • Hey guys, I’m trying to use wordpress’ Meta value feature. I want to display posts that are greater than a variable that I define via PHP.

    The site displays posts that are ordered by event date (100209 for example) and I want to make sure they are in the future (IE >= $currentdate )

    Any idea how I can pass a variable into this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Oh Here is my code

    query_posts(‘&orderby=meta_value&meta_key=eventdate&order=ASC&meta_compare=>=$currentdate’ );

    don’t forget to specify the meta_value for the compare. it should look like this.

    query_posts(‘&orderby=meta_value&meta_key=eventdate&order=ASC&meta_compare=>=&meta_value=$currentdate’);

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Query Posts Meta Compare by Variable’ is closed to new replies.