• Okay got a TOUGH one for you guys:

    Have this:

    <?php comments_popup_link(‘0′,’1′,’%’, ‘ ‘, ‘-‘); ?>

    But I’m trying to do this

    <?php comments_popup_link(‘0′,’1′,’%+5’, ‘ ‘, ‘-‘); ?>

    (obviously this does not work but renders something like 32+5 instead of 37)

    I know this CAN be done, just don’t know how…

    Thank yew!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    It CANNOT be done as something you pass to the function. The argument parsing is simply not very sophisticated. But you are right, it’s possible to alter the count.

    To make the process easier, just pass the ‘%’ with no text as you first illustrated, even if you do want additional text. (it actually doesn’t matter what you pass, the % alone reflects what’s happening conceptually) Hook the ‘comments_number’ filter. Your callback is passed the comment count as the second parameter in the form of an honest integer. Ignore the first parameter, it’s the same number as a string.

    Do whatever math you want with the comment count integer, then if you like, concatenate any string you like to the result and return the whole thing, something like this: return ( $int + 5 ) . ' ruminations';.

    Thread Starter gnarayan

    (@gnarayan)

    Thanks a mil. Gonna have to tackle this after work because it looks complicated…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Comment counts: Manually add (some number) to the count’ is closed to new replies.