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

Add simple field column to the posts screen

Ref. https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column Just use the WP built in action called “manage_posts_custom_column” and in callback check for the correct column and add simple_field value with the function simple_fields_value : add_action( ‘manage_posts_custom_column’ , ‘add_new_column_data_in_posts’, 10, 2 ); function add_new_column_data_in_posts( $column, $post_id ) { switch ( $column ) { case ‘premium’ : echo simple_fields_value(“simple_field_slug”, $post_id); break; } }

wp query for popular post with simple field

The correct query is: $args1 = array( ‘showposts’ => 5, ‘ignore_sticky_posts’ => 1, //ORDER ARGUMENTS ‘meta_key’ => ‘post_views_count’, ‘orderby’ => ‘meta_key_num’, ‘order’ => ‘DESC’, //META QUERY ‘meta_query’ => array( array( ‘key’ => ‘_simple_fields_fieldGroupID_2_fieldID_1_numInSet_0’, ‘compare’ =>’NOT EXISTS’ ), ), ); $popularposts = new WP_Query($args1); The order aguments are always outside meta_query, see the codex.

tech