Current Term posts count

#197705
  • Resolved Oleg
    Rank Math free

    Hello

    I’d like to know if it’s possible to display in search results Current Term posts count.
    I mean, for example, I have Custom Post Type “Hospitals” and have taxonomy for it – “Specialization”.

    Can I display in SEO results of terms to show “45 Allergology hospitals”? where Allergology is a term of Specilization?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. Iā€™m sorry for the delay.

    You can create a custom var that gets the number of posts in the current category by using the following filter:
    https://rankmath.com/kb/filters-hooks-api-developer/#23-filter-to-add-custom-variable-replacements

    Then you can use the replacement variable %count(varname)% and define a custom variable name that will be used to get the term.

    I hope that helps.

    Thank you.

    Oleg
    Rank Math free

    Hi
    Thanks for response. Please can you explain me staep by step – as I’m not a programmist) i need to add this code to my website? and what to change in it? and where to insert name of taxonomy -or i don’t need to do it?

    Brian
    Rank Math free

    Hello,

    Thank you for contacting Rank Math again.

    I am sorry but this is not as simple and direct as you would wish to be.

    You can check this thread which is similar to your situation and use the suggested solution: https://support.rankmath.com/ticket/code-for-categories/.

    You may have to seek developer assistance to successfully implement this.

    Looking forward to helping you. Thank you.

    ā€‹ā€‹ā€‹ā€‹ā€‹ā€‹

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Current Term posts count’ is closed to new replies.