WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Separating the and the text in comments_popup_link in index.php (5 posts)

  1. ransom1337
    Member
    Posted 4 years ago #

    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.

  2. Aaron
    Member
    Posted 4 years ago #

    Try this instead.

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

  3. chinmoy
    Member
    Posted 4 years ago #

    1. option

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

    2. option

    Comments <?php comments_popup_link(' (0)', '1', '%'); ?>
  4. ransom1337
    Member
    Posted 4 years ago #

    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.

  5. ransom1337
    Member
    Posted 4 years ago #

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

    Thanks for your help, people!

Topic Closed

This topic has been closed to new replies.

About this Topic