Support » Themes and Templates » Add post title to comment link text?

  • Ok, I’m trying to change the link text to the comments in my blog. I have figured out how to change it from the default to some sort of “predefined” text. However, what I’d like to to is to change the link to read “comment on <the title of the post>”

    Here’s the code I tried to change, but it’s not working. (I’m new to WordPress and php, but I understand programming)
    <?php comments_popup_link(‘Add a comment’, ‘some comments’, ‘comment on ‘ . the_title()) ?>


Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff


    Volunteer Moderator 🚀

    I looked at that, however, I can’t figure out how to append the title to the text and make it appear as a hyperlink, namely this part here

    ‘comment on ‘ . the_title()

    Actually, the text displays properly when I use

    the_title(‘comment on ‘)
    within the comments_popup_link function, but then the “link” is not hyperlinked. Any ideas?

    This will do what you’re after (for 2 or more comments, at least):

    <?php comments_popup_link('Add a comment', 'some comments', 'comment on ' . get_the_title()); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add post title to comment link text?’ is closed to new replies.