• I have a standalone link in my sidebar, “All posts”. How can i add a count of all published posts to it?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Run a query using the global $wpdb object. Your query should include the SQL_CALC_FOUND_ROWS keyword and LIMIT 0,1. The LIMIT does not influence the found rows count. Your query must properly include or exclude posts you want or don’t want to count. Check your count against the counts on the posts admin screen to ensure you’re getting the correct count.

Viewing 1 replies (of 1 total)

The topic ‘count_posts to a standalone link’ is closed to new replies.