Support » Themes and Templates » Separating the and the text in comments_popup_link in index.php

  • Resolved ransom1337



    I am looking to have the text “1 Comments” (etc) without having it act as a hyperlink to the comments of the post. Likewise, elsewhere I am trying to have the hyperlink of the same aforementioned comments text, but without the text, instead using an image.

    In index.php I realise that:

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

    is the script that gets this bit working, but it only acts as a hyperlink and text as one whole. Is there any way of getting one or the other?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Try this instead.

    <?php comments_number('Comments (0)','Comments (1)','Comments (%)'); ?>

    1. option

    <?php comments_popup_link('0', '1', '%'); ?>

    2. option

    Comments <?php comments_popup_link(' (0)', '1', '%'); ?>

    Try this instead.

    <?php comments_number('Comments (0)','Comments (1)','Comments (%)'); ?>

    Thanks wpbum, that worked perfectly. Would you happen to know how I can obtain the hyperlink and use that elsewhere? I’m trying to make an entire div clickable with the link to the comments, which I know how to do in HTML/CSS, but just don’t know how to get the hyperlink on its own using the PHP.

    Ah, it’s alright, I just found it in the codex. It’s
    <?php comments_link(); ?>

    Thanks for your help, people!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Separating the and the text in comments_popup_link in index.php’ is closed to new replies.