Support » Plugin: WordPress Popular Posts » "Custom HTML Markup" inserting anchor automatically

  • Resolved Jacob Dubail



    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,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Hector Cabrera


    Hi Jacob,

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

    Thanks Hector! Much appreciated!


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


    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.


    Plugin Author Hector Cabrera


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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘"Custom HTML Markup" inserting anchor automatically’ is closed to new replies.