WordPress.org

Support

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

[Resolved] Separating the and the text in comments_popup_link in index.php

  • ransom1337
    Member

    @ransom1337

    Hello,

    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?

    Thanks.

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', '%'); ?>
    ransom1337
    Member

    @ransom1337

    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.

    ransom1337
    Member

    @ransom1337

    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 ‘[Resolved] Separating the and the text in comments_popup_link in index.php’ is closed to new replies.