How to select posts from multiple categories and metavalues?

Since version 3.1 WP got much enhanced querying of custom fields. If I got the code right your query should be something like this: query_posts(array( ‘category__and’ => array(1,2,3), ‘meta_query’ => array( array( ‘key’ => ‘length’, ‘value’ => array($min_length, $max_length), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘NUMERIC’, ), ), )); See: Function Reference/WP Query > Custom Field … Read more

How to make condition, based on custom fields value?

Sorry but it’s not clear what you want to do. From what I understand is you simply want to use an elseif statement: <?php $pageNumbered=get_post_meta($post->ID, ‘page-number’, true); ?> <?php if ( $pageNumbered ) : ?> <div class=”page-number left”> <?php echo get_post_meta($post->ID, “page-number”, true); ?> </div> <?php elseif($pageNumbered == “Z”) : ?> <div class=”page-number left”> <?php … Read more

wordpress custom fields multiple data

You can store an array in a custom field; WordPress serializes it for you on save and unserializes it on get. Name your fields with a pseudo array syntax: <input name=”mycustomfield”> <input name=”mycustomfield[date]”> You’ll get a $_POST array: mycustomfield = array ( ‘audio’ => ‘somevalue’, ‘date’ => ‘somedate’ ) Now you can do whatever you … Read more