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
- Can’t understand why sometimes a [caption] field appears
- Page and post loop same template
- Getting blog pagination to work on page set as front page
- How to group only VISIBLE posts? [closed]
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- search blog posts by author first name and or last name
- Show metabox value last post excerpt, title and link
- Count several post tags
- On what hook can I get the queried object’s final state?
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- Get post number both in the loop and in the post
- wp_query with ajax
- How to give classname to post if post has no content?
- Custom wp-query in wordpress rest api
- WP_Query: Show 10 posts in date order, first three random
- How can I insert a new markup element after 4 posts automatically? [closed]
- Exclude some posts from displaying in wp_query based on some condition
- posts_per_page returning only one post
- If no posts exist for current day and month, show the next available day of posts
- Count the number of a post types associated with another post type
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- How to display post list in a table layout (multiple queries in single loop)
- Conflict array_splice on loop and query in widget
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Get all custom posts with a certain taxonomy
- WP_Query custom field pass the post id
- How to convert query sql to shortcode in wordpress?
- Link to date_query results in WordPress
- wp_query if have posts show date but not in loop
- Use posts_where to exclude posts ids from wp_query
- Query function not executed between element [closed]
- Custom WP_Query not working correctly
- When WP_Query only returns 1 post, how do I automatically redirect to that post?
- WordPress query portfolio posts
- Current and next month posts
- WP_Query of Category Not Showing First Post
- Get latest author posts inside the loop
- Display amount of pending posts in back/front end
- Limiting post list by taxonomy
- Why does WordPress search returns same number of results for every search query?
- Creating a related posts section in wordpress inside a default post
- Same post appears in related Posts?
- How to display WP Query filters?
- Finding a post’s slug
- Count user posts and store the number for later use
- Display 3 posts with different HTML markup using a loop
- Sidebar limiting to 10 posts?
- why the posts queried from sql is more than those showed on the page?
- Change content off every sixth element
- Is there a function to get post info for any publish_status by post ID?
- How Can I Always Display A Particular Post First Using WP_Query?
- Optimal WP Web App Backend for mobile app development
- WP_Query get posts in custom database table [duplicate]
- WP query taxonomy optimization
- Override WordPress core post-template.php block template
- How to show multiple posts thumbnail, title and date in widget
- How do I display main query posts in random order using add_filter
- Count the total views of all user posts published
- WP_Query outputs wrong post in custom post type
- WordPress Query – Display 5 posts (same post type), each from a given tag
- While loop in functions.php outputting the_title() of each post on frontpage
- how to show comments only author which send own posts in wordpress
- Group first, 2nd, 3rd, etc posts by category terms
- Manipulated offset and pagination, can’t display last post anymore
- Show posts from two specific category in WP_Query
- Why sorting posts doesn’t work properly?
- Change Old WordPress Post Date Year
- How to create loop of posts except post ID defined via ACF field
- Author post count in category
- Set post title font size automatically according to number of words in post title
- Displaying all posts from other sites on the network on one site
- the wp_post_update isn’t working all the time
- Function is printing twice – any suggestions?
- Display/Filter post using if else statement
- How to sort WP_Post Object array by object field in php?
- 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
- Display specific posts based on an ID of another post
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- Order by meta_key field in WordPress not meta_value field value
- a WordPress connected to 2 database
- How to display particular set of wordpress post on a webpage?
- query posts with selected post ids first
- Change URL of previous posts and next posts link in WordPress
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- How to create page with post content in it?
- Show post count in custom taxonomy page