WordPress.org

Forums

WordPress Popular Posts
[resolved] "Custom HTML Markup" inserting anchor automatically (6 posts)

  1. Jacob Dubail
    Member
    Posted 2 years ago #

    Hey,

    Thanks for the great plugin.

    I'm trying to use the "custom html markup" feature of the widget. I really want to be able to do this:

    <li><a href="{url}">{thumb}{title}</a></li>

    But that inserts an extra anchor link into the markup. How can I get actual control over the markup? I want a single anchor to wrap the entire contents of the list item.

    Many thanks,
    Jacob

    http://wordpress.org/extend/plugins/wordpress-popular-posts/

  2. Hector Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Jacob,

    Use the {text_title} content tag instead, {title} is replaced by a linked post title hence the extra anchor tag.

  3. Jacob Dubail
    Member
    Posted 2 years ago #

    Thanks Hector! Much appreciated!

    -Jacob

  4. Jacob Dubail
    Member
    Posted 2 years ago #

    Can I do the same for the {thumb}? It gets auto-wrapped as well, it appears.

    -J

  5. Jacob Dubail
    Member
    Posted 2 years ago #

    It looks like around line 1234 of wordpress-popular-posts.php you need to add ENT_HTML5 to the htmlspecialchars_decode call.

    $content .= htmlspecialchars_decode( $this->format_content($instance['markup']['post-html'], $data, $instance['rating']), ENT_HTML5 | ENT_QUOTES ) . "\n";

    This allows us to wrap anchors around other block level elements.

    -J

  6. Hector Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the suggestion, Jacob! Will add your patch to the next release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Popular Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.