• Resolved sam

    (@samjoelnang)


    My website has a taxonomy artists, under which artist names serve as terms. I’m on a taxonomy term archive for an artist. I am already able to display posts that belong to the current term. I put as <div> the following:

    Album reviews

    EP reviews

    Track reviews

    Interviews

    I want these to display the number of posts that belong to the current term and are in the said categories.

    Album reviews (x)

    EP reviews (x)

    Track reviews (x)

    Interviews (x)

    Where x is a number from 0.

    Here’s my code and what I aim to accomplish:

    <div?id="track-and-album-rev"?class="track-and-album-revs">
    <?php?if(has_term($term,?'artists'))?{
    echo?'<h1?style="display:table">Album?reviews';
    echo?'<span?style="display:table-cell;?font-size:20px;?vertical-align:middle">&nbsp(';
    I need to output the post count of the category "album-reviews" here;
    echo?')</span></h1>';
    echo?do_shortcode('[display xxx]');
    }
    xxx and so on...

    Any advice is highly appreciated!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter sam

    (@samjoelnang)

    To those interested in achieving the same thing, I figured it out using @bcworkz’s advice on a related Topic.

    Luckily I only needed to output the number of posts for four categories whose posts are displayed on a taxonomy term archive page. I just added them as new WP_Query objects and echoed them with the $found_posts property in their corresponding <span>.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.