You can use wp_count_posts
Example using code above:
$count_posts = wp_count_posts('post');
if ( $count_posts ) {
$published_posts = $count_posts->publish;
}
<a href="https://wordpress.stackexchange.com/questions/250800/YOUR_LINK">YOUR TEXT <?php echo $published_posts; ?></a>
Related Posts:
- How to mark every 3rd post
- Count posts within a custom post type and specific taxonomy and terms?
- How to Display a List of Users Who Have Made at Least 1 Post?
- How to Display Network Post Count?
- How to cache a shortcode functions output?
- Count posts in category including child categories
- Count singular post views automatically
- Set font size automatically according to number of words in post
- Network wide post count (WP Multisite)
- Redirect based on user post count
- Alternate custom content in the loop
- Show that current post is number X out of X
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Double count view in archive.php
- Count to how many categories a post belongs to
- Count total number across post types
- Count search results in heading
- How to hide first gallery for every post?
- Counter of posts ever posted – even deleted ones
- Display Published Posts Count for Certain Time Period
- How can I get global $post to work for CPT and update user?
- Display Notification Bar on Header on Certain Post Count
- Show posts count for Categories and Tags in wp_nav_menu
- How to add category post count in main navigation menu [closed]
- Count number of posts of current month
- Howto show comment count by post in post?
- Counter is skipping post when I still want it visible [closed]
- Count several post tags
- Get post number both in the loop and in the post
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Count the number of a post types associated with another post type
- Echo the number of posts being displayed
- Display amount of pending posts in back/front end
- Count user posts and store the number for later use
- why the posts queried from sql is more than those showed on the page?
- Count the total views of all user posts published
- Author post count in category
- Set post title font size automatically according to number of words in post title
- Show post count in custom taxonomy page
- Count singular post views automatically
- How to count posts in tags within time limit
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- Counting Posts by Category
- Display number of post published every day
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Alternative content between posts no repetition
- How to control Post view count incresing in sidebar widget posts too?
- How to mark every 3rd post
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- How to limit the number of posts a user can publish based on user type
- ho can I get the number of the current post instead of the post id?
- post_count not working
- Adding Count Post in Page
- Count words for all posts by all authors
- Word count for all posts of all authors
- Display post count on archive page in reverse order
- Print Current Post Index number within Loop
- How To Disable (or Remove) “All Posts, Published, and Trash” in Dashboard Posts
- How to manually link posts to each other in WordPress
- Post/Page Publish/Update button not clickable once I make an edit
- $post->ID not working
- Setting pagination for images attached to a post
- blog page showing only first post
- Is it possible to show a different WP menu when using password protected pages?
- POST from jQuery to PHP
- get_post_custom stripping styling issue
- Redirect before post page
- Fetch posts from current week (Sunday to Saturday)
- Using radio button meta data from a custom meta box
- Get posts by multiple ID’s (query)
- Add a class to post title if a link ends with a certain extension
- Admin Notices don’t display on the admin screen for certain post
- is there a way to show the the post title after the image?
- Add the description field on the attached media
- Is there a way to notify specific users when new posts are published to specific pages?
- get_adjacent_post by language
- Force authors to Preview a post before publishing
- While loop articles – if statement order
- How to get post body look same as my visual editor?
- Isn’t the way posts are displayed very unefficient?
- Post Filtering by GET URL parameters
- showing posts of an specific category in admin custom menu with style of admin posts section
- Related Posts function not working
- post type slug vs page slug
- marking a post that was sticky on category template
- Extract the last published post
- How show custom message after post pulished or update
- long-title posts do not want published
- how to fetch posts from Api in chunks or parts?
- if CPT content is empty then
- Compare date of user’s last posts
- Only get post_id [duplicate]
- Disable `create_post` for built-in post type
- how to create other sizes of original image in one go wordpress uploads
- Can’t seem to replicate permalink structure for localhost development site
- Newly created category does not show category
- Authors can edit all posts, except when an owner is specified?
- WordPress Custom Theme: My site shows the same posts on Page 1 and Page 2 and so on [duplicate]
- WordPress post enumeration
- Output number of WordPress posts remaining until a post milestone is reached