Forums

[resolved] Using post count (3 posts)

  1. Gilnaa
    Member
    Posted 1 year ago #

    I'm trying to put a post counter at the header template:
    <h5><?php wp_count_posts('post', '')->publish; ?> uses</h5>
    But it doesn't work (Shows only "uses")

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    try and add an echo to your code; wp_count_posts() only returns the value, but does not put it out:

    <h5><?php echo wp_count_posts('post', '')->publish; ?> uses</h5>

    http://codex.wordpress.org/Function_Reference/wp_count_posts

  3. Gilnaa
    Member
    Posted 1 year ago #

    Thank you :)
    It works!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags