WordPress.org

Ready to get started?Download WordPress

Forums

Add post title to comment link text? (4 posts)

  1. yatchie
    Member
    Posted 8 years ago #

    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()) ?>

    Thanks.

  2. yatchie
    Member
    Posted 8 years ago #

    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?

  3. Kafkaesqui

    Posted 8 years ago #

    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()); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags