Page 1 of 1

Variable with either/or results

Posted: Sat May 22, 2010 10:51 am
by mercurynv
I'm working on an events calendar for a wordpress site

What I can accomplish so far

a) through the use of a custom field the author can add a date (05/22/2010) or in a second custom field enter a day (Saturday)

b) with a query_posts I can display only posts that have either a date or a day assigned to them.

What I am trying to accomplish is displaying in the same list, posts that have either todays date or todays day assigned to them.

The code I have so far

Code: Select all

<?php $todaysDate = date('m/d/Y'); ?>
<?php query_posts('meta_key=date_value&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC&orderby=title'); ?>
and

Code: Select all

<?php $today = date('l'); ?>
<?php query_posts('meta_key=dayofweek_value&meta_value=' . $today . '&orderby=meta_value&order=ASC&orderby=title'); ?>
What I can't figure out is how to get it to list everything that is happening on a given date no matter if the date was entered as "05/22/2010" or "Saturday".

So I'm looking to merge the results of both date formats and display them as one. Can I get it to show all results for $todaysDate and $today ?

Thannks

Re: Variable with either/or results

Posted: Sat May 22, 2010 12:36 pm
by AbraCadaver
This is easy using SQL, however you would need to post the code for the query_posts() function for those not familiar with Wordpress.