Replacing comment text with an image? (6 posts)

  1. shadow
    Posted 11 years ago #

    Can anyone tell me how you go about replacing the text 'Comments' with a linking image instead?
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>

    Thanks if you can help :)

  2. Kafkaesqui

    Posted 11 years ago #

    <?php comments_popup_link('<img src="/path/to/nocomment.jpg" />', '<img src="/path/to/onecomment.jpg" />', '<img src="/path/to/manycomments.jpg" />'); ?>

  3. shadow
    Posted 11 years ago #

    Thanks Kafkaesqui - much appreciated :)

  4. chiensavant
    Posted 11 years ago #

    May I suggest you to also add the alt attribute for validation purposes ?

    Something like
    <?php comments_popup_link('<img src="/path/to/nocomment.jpg" alt="No comment" />', '<img src="/path/to/onecomment.jpg" alt="One comment"/>', '<img src="/path/to/manycomments.jpg" alt="Many comments"/>'); ?>

  5. shadow
    Posted 11 years ago #

    A good suggestion chienservant :)

    Already added - thanks :)

  6. pepster
    Posted 10 years ago #

    hey cool. i have the same problem now.

    the thing is, the image i want is in my theme directory. i tried using <?php bloginfo(stylesheet_directory); ?> inside <?php comments_popup_link...> like this:

    <?php comments_popup_link('<img src="<?php bloginfo(stylesheet_directory); ?>/icons/comments.png">, (and so on...)

    but it doesn't work. any ideas? :D

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.