This code is based on the following page on WP Recipes:
http://www.wprecipes.com/how-to-set-post-expiration-datetime-on-your-wordpress-blog
I’ve gotten this code to work on the “Movies” page of the site using the following version of the code:
[Code moderated as per the Forum Rules. Please use the pastebin]
Thank you in advance for your help!!!!!
I should also note that depending on how I edit the code above (the first one) it occasionally erases the meta data in my database on one or many of the posts. That is irritating.
This is the code that is not working on the homepage.http://pastebin.com/eU4Rcwr1
This is the code that works on my “movies” page.
http://pastebin.com/ATwFigig
not sure if you’ve seen this, but custom field queries are built into WP_Query and are relatively straight forward. I just used this type of query on a recent website to find a couple “related posts” by posts with the same “author” meta key /value.
A note:
the only way I was able to get the query to work was the more extended version that is used for multiple key pairs, even though I was only using one key pair
$args = array(
'post_type' => 'product',
'meta_query' => array(
array(
'key' => 'color',
'value' => 'blue',
'compare' => 'NOT LIKE'
),
array(
'key' => 'price',
'value' => array( 20, 100 ),
'type' => 'numeric',
'compare' => 'BETWEEN'
)
)
);
$query = new WP_Query( $args );
http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters