ThemeShaper Forums » Thematic

[closed]

Add comment_count to my_multiplecomments_text

(7 posts)
  • Started 2 years ago by 1visible
  • Latest reply from middlesister
  • This topic is not resolved
  1. 1visible
    Member

    Hi again,
    please, how to add $comment_count > 1 ? __ (…) to this? :

    function my_multiplecomments_text($text) {

    return 'personnes vous offrent leur témoignage';

    }
    add_filter('thematic_multiplecomments_text', 'my_multiplecomments_text');

    This function make the comment_count to disappear :(

    Sorry, I'm not a php crack (this means all my trys are falling down, bouh!).

    Posted 2 years ago #
  2. That filter feeds into printf() and you are missing the integer specifier: d

    Try:

    return '%d personnes vous offrent leur témoignage';

    Posted 2 years ago #
  3. 1visible
    Member

    "The simplest is the most difficult… unless you have the key…"
    Ok dear, you did it!
    Thank you :)

    Posted 2 years ago #
  4. 1visible
    Member

    Sorry but I just realize:
    Is there any way to print this return on sidebar ?
    I use PHPcode widget, the result is "0 (nobody) personnes vous offrent leur témoignage"

    Posted 2 years ago #
  5. This line from Thematic's comments.php give an example of using the global variable $thematic_comment_count to account for text strings for singular or multiple comments.

    <h3><?php printf( $thematic_comment_count > 1 ? __( thematic_multiplecomments_text(), 'thematic' ) : __( thematic_singlecomment_text(), 'thematic' ), $thematic_comment_count ) ?></h3

    Posted 2 years ago #
  6. 1visible
    Member

    Yes, that's what I have done. But the result is always "zero comments…" instead of for exemple "28 comments…".

    The fact is I have only one page with opened comments, it's a testimonial page.
    The query here is: how to display in the sidebar on the entire site, the number of those testimonials from this particulary page ?

    I can edit a simple html line by hand to do that, of course.
    But I was hoped than the Thematic power could do this by itself.

    With my noob words I'll tell something like:
    "It's missing the "page ID filter" to tell how many comments there are on this page."

    Posted 2 years ago #
  7. middlesister
    Member

    If you want to display the number of comments in the sidebar, you cannot use $thematic_comment_count because it will refer to the number of comments belonging to the current post. Plus, I think it only works inside the comment loop

    Try using the good old get_comments_number( $ID ), and give the testimonial postID as parameter.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.