Forum Replies Created

Viewing 1 replies (of 1 total)
  • I am using the Search-Everything plugin which will add a span tag to a post’s title (for highlighting) when it finds a match. Unfortunately the span tag is included in the title attribute of the Comment link. For example, if I had searched for “post”:

    <a href="xxx" title="Comment on My <span class="hilite">Post</span>">

    However, the span tag is not included in the title attribute of the permalink from the post’s title:

    <a href="xxx" title="Permanent Link to My Post">

    I did some poking around in the code and found that the function that generates the comments link, comments_popup_link(), uses esc_attr(get_the_title()) to retrieve the post title, while the permalink from the post’s title uses the_title_attribute(). So, I modified the comments_popup_link() function to use the_title_attribute() instead of esc_attr(get_the_title()). Now I always get a clean title attribute in the comments link.

    I changed line 971 in comment-template.php (wp 2.8.3) from

    $title = esc_attr( get_the_title() );

    to

    $title = the_title_attribute('echo=0');

    Rich, the the_title_attribute() function is more or less the same as esc_attr(strip_tags(get_the_title())), so you were on the right track. The changed line could just as well be

    $title = esc_attr(strip_tags(get_the_title()));

    I suggest that this is a bug and should be fixed in a future release. I am new to WordPress, so I want to get some feedback (like Reporting Bugs suggests) before I go telling the developers how I think it ought to be done.

    Thanks,
    Eric

Viewing 1 replies (of 1 total)