WordPress count post
-
How can i count wordpress post. I am using custom post type UI and advanced custom field. I have created a post type called (product) and it has a fieldname called (product_family) which is a select tag and it has a 3 inside it (Latest,Car Navigation and Car Recorder).
I tried codes like this but cannot get it. How can i count the number inside of the select tag.
$args = array( 'post_type' => 'product', 'post_per_page' => -1, 'meta_key' => 'product_family' ); $query = new WP_Query($args); $count = $query->post_count; echo '<p>' . $count . '</p>';
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘WordPress count post’ is closed to new replies.