WordPress.org

Ready to get started?Download WordPress

Forums

!!!Comment link Button!!! (13 posts)

  1. frumgenius
    Member
    Posted 5 years ago #

    Hey everyone! I was getting feedback that the comment link on the bottom of each post was being ignored because it blended in to everything else.

    Thus, I wanted to create a comment button.

    I succeeded in making a button that displays the amount of comments on each post with the following code in index.php:

    <button type="button"> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></button></p>

    Problem is that the button doesn't link anywhere.

    Simple question----what do I have to add to make the button link to each post's comments?

  2. frumgenius
    Member
    Posted 5 years ago #

    Anybody with any insight on this?

  3. mikokagome04
    Member
    Posted 5 years ago #

    Wait a sec... isn't there already a link generated inside the button? comments_popup_link() generally spits out an anchor tag with the single post URL already included.

  4. frumgenius
    Member
    Posted 5 years ago #

    I dunno. For some reason the button does not do anything. It seems that this code just puts the amount of comments on the button. Example: 3 Comments>>

  5. frumgenius
    Member
    Posted 5 years ago #

    If anyone needs to see this in action....here is a link to my blog.

    Thanks a brazillion...

  6. frumgenius
    Member
    Posted 5 years ago #

    Please assist. Thanx.

  7. ...Buttons, why does it have to be buttons...?

    Try this instead

    <a href="<?php comments_link(); ?>"><button type="button"><?php comments_number('No comments &raquo;','1 comment &raquo;','% comments &raquo;'); ?></button></a></p>
  8. frumgenius
    Member
    Posted 5 years ago #

    Nothing Doing. Thanks for the try though. All that this code did was underline the text in the button. Still not linking though....

    Anyone else with any insight?

  9. Weird. When I wrap the button in ... it works for me. When I do it the way you posted I get a button to nowhere.

    Good luck.

  10. frumgenius
    Member
    Posted 5 years ago #

    Really? That's interesting.....Doesn't work for me.....

    Does anyone else have any input on this topic???

  11. frumgenius
    Member
    Posted 5 years ago #

    Is anyone out there?

  12. mikokagome04
    Member
    Posted 5 years ago #

    I still don't understand why the link isn't working. If you still insist on a <button>, however, you could use JavaScript instead:

    <button type="button" onclick="javascript:location.href='<?php comments_link(); ?>'"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></button>

    It's not the best (or most semantically correct) solution, but it should work.

    Alternatively, why not just use CSS to style the comment link? Simply wrap the comments_popup_link template tag in a <span> or <div> and use style rules to duplicate a button effect.

  13. Mugsy
    Member
    Posted 5 years ago #

    Where are you placing your code? At the bottom of each post?

    Does anyone know if this problem has been fixed (or what's causing it)? I only just realized after a week (since upgrading) that my Comment links are missing. :(

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.