• Hello,

    I’m looking for a way to display the post count of the current loop. I was hoping that works like with the comment count. But it should override the count of 9 set in the loop, because I need the total postcount of the taxonomy “cars” with the value “red-cars”.

    My Idea:

    [loop type="posttype" count="9" taxonomy="cars" value="red-cars"]
        [content count] Red Cars
    [/loop]

    I hope your plugin offers a way to accomplish this ??

    Kind Regards,
    Dennis

    https://www.ads-software.com/plugins/custom-content-shortcode/

Viewing 1 replies (of 1 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello, sorry for the late reply!

    Hmm..this is a difficult one – when the count parameter is set, the query returns only that number of posts, so there’s no way for the loop to know the total number expected.

    There is an undocumented shortcode [loop-count] which displays the current post count in a loop. It can be used after a loop to display the total:

    [loop type="post"..]
      ...
    [/loop]
    
    Total: [loop-count]

    However, this won’t work in your case because if you set count=”9″, the total will be 9.

    Theoretically, if you only need the total post count for a specific query, you could run an empty loop..

    [loop type="posttype" taxonomy="cars" value="red-cars"]
    [/loop]
    
    Total number of red cars: [loop-count]

    It seems like there could be a more efficient way to do it.

Viewing 1 replies (of 1 total)
  • The topic ‘Display Post Count of Current Loop’ is closed to new replies.