WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
[resolved] Links showing up oddly formatted (3 posts)

  1. v4pe
    Member
    Posted 3 years ago #

    The links on the front page have the title, follow by "> and then the title again. I read that I shouldn't use <?php the_title(); ?>"><?php the_title(); ?>, as this will cause problems. The difficult part is that the theme I'm using uses the following

    echo '<h2 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark" title="Permanent link to ' . get_the_title() . '">' . get_the_title() . '</a></h2>' . "\n";

    Is there any way to fix this? Thanks

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    A) Remove the "title" attribute altogether:

    echo '<h2 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h2>' . "\n";

    B) Use striptags():

    echo '<h2 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark" title="Permanent link to ' . striptags(get_the_title()) . '">' . get_the_title() . '</a></h2>' . "\n";
  3. v4pe
    Member
    Posted 3 years ago #

    Great, I just used the first suggestion and it worked. Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic