0
down vote
accepted
I think it would help you to read this => http://wordpress.org/support/topic//display-number-of-posts-per-category
function number_postpercat($idcat) {
global $wpdb;
$query = "SELECT count FROM $wpdb->term_taxonomy WHERE term_id = $idcat";
$num = $wpdb->get_col($query);
echo $num[0];
}
Related Posts:
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Echo the number of posts being displayed
- Should we trust the post globals?
- How to mark every 3rd post
- Get first post from wp_query
- How to cache a shortcode functions output?
- Querying post from a multisite network
- How to query serialized array by comparing greater than (>=)?
- How to know if get_posts() failed?
- Show related posts by category but ignore one category
- post__in for get_posts with a dynamic array
- Query posts distinct authors
- Count singular post views automatically
- Set font size automatically according to number of words in post
- Post content being duplicated by the_content();
- Specific loop in Shortcode
- Sort posts by activity date
- How to add padding between posts
- Working Bootstrap Carousel Conversion to WP – Technical Questions
- Search widget breaks when using multiple loops?
- How to change bulk post status
- Add few specific post ids to wp_query
- WP_Query posts_per_page ignored
- wp_query ‘s’ parameter does not work with custom post type
- WP Query related posts by current page Tag ID
- WP_Query get posts from custom posts by category
- Accessing post->ID outside of the loop for listing child pages
- WP Query – duplicated posts once including tags in search results
- Reset Popular post query?
- Query Posts multiple conditions
- how to get posts ids inside pre_get_posts filter?
- Future post ID not showing
- How do I use WP_Query to get a range of posts with custom fields that have numbers with letters in them?
- recent posts for different categories
- Search by post title and content in wp_query without order
- Change post order random through out the entire WordPress
- Setup a custom dynamic post
- Anyway to grab author name and featured image in an embeded in inital array of posts outside of loop?
- Removing noindex posts from wp_query
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- Exclude the first ‘n’ number of posts of a tag from home page?
- wp_posts table: safely remove unused columns to save database storage
- Using wp_list_pages() after calling query_posts()
- how to get post order by post id wp_query?
- Possible to alternate between two loops
- How to add category post count in main navigation menu [closed]
- How to display all posts divided/ordered by post date? [closed]
- Why are my paginated posts always returning the same results?
- Is it possible to use WP_Query to only pull posts with attachments?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Counter is skipping post when I still want it visible [closed]
- Query posts by Author and/or by Tag
- Can’t understand why sometimes a [caption] field appears
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- wp_query with ajax
- Exclude some posts from displaying in wp_query based on some condition
- How to convert query sql to shortcode in wordpress?
- Use posts_where to exclude posts ids from wp_query
- Why does WordPress search returns same number of results for every search query?
- Sidebar limiting to 10 posts?
- WP_Query get posts in custom database table [duplicate]
- WP query taxonomy optimization
- Override WordPress core post-template.php block template
- Change Old WordPress Post Date Year
- Author post count in category
- Displaying all posts from other sites on the network on one site
- Display/Filter post using if else statement
- Search results for ACF data
- Multisite how to display merged posts from two sites and sort by latest date?
- Query prints posts without specific categories
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- Show post count in custom taxonomy page
- Count singular post views automatically
- How to count posts in tags within time limit
- Using a meta_value or postdate to to query and orderby
- Exclude posts in home slider from sections
- Override wp_link_pages pagebreak with filter
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Loop through all posts showing duplicates
- WP_Query extended with AJAX
- Manipulate query to show specific post
- WordPress text field in array problem
- Random order of the 5 most popular posts
- My custom query is displaying random posts in random order
- Get query result according to merged array
- Blog only showing one post even though more published
- Sort / Filter Queries
- How to show the posts list into a static page? Problems to use the loop into a static page
- How do I control the fallback query after the original query returned cero posts?
- Order posts by separate menu order for different sub-categories
- Displaying Results From Custom Taxonomy Query
- Multiple loops on a Search result page?
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- Exclude sub sub categories from displaying in the archive page
- How do I show the post title if an advanced custom field hasn’t been used?
- Adding Count Post in Page
- How add class the_content();?
- Get related posts matching most of the provided tags using WP_Query
- WP_Query post_tilte search in posts table