Getting and calculating averge value of custom fields of the same tag

If its a regular custom field you can add this to your archive.php: //before the loop $rating_count = 0; $total_rating = 0; //in the loop $total_rating = $total_rating + get_post_meta($post->ID,’your_custom_field_name’,true); $rating_count = $rating_count + 1; //after the loop: $average = $total_rating / $rating_count; echo ‘the average rating for this tag is: ‘ . $average; Update … Read more

Counting post fields

You can do custom query loop for that particular meta box for an empty value. Something along the lines of $check_city_value = get_post_meta($post->ID, ‘city_box’); ?> if (empty($check_city_value)) { echo ‘$check_city_value is either 0, empty, or not set’; } You would have to loop through all the posts to do this and for multiple meta box … Read more

How to automatically change a posts status to draft based on custom field

For cron jobs, take a look at the Transients API. The rest could maybe be acchieved with something like the following. I have never ever used the transient API before and code’s not tested. function set_post_to_draft() { global $post; if ( get_post_meta( $post->ID, ‘set_to_draft_key’ ) == true ); return $post->post_status == ‘draft’; } set_transient( ‘post_to_draft_transient’, … Read more

Odd functions.php issue in WordPress

There is no WordPress function called meta(). Try using get_post_custom() (Codex ref) instead. For example: //Address add_action( ‘woo_post_inside_before’, ‘my_address’ ); function my_address() { if ( is_single() && in_category(‘listings’) ) { global $post; $meta = get_post_custom(); echo ‘<h1>’ . $meta[‘address’] . ‘</h1>’; } } Note: I’m not sure you need to call global $post; in this … Read more