WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. jacobdubail
    Member
    Posted 1 year 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. Héctor Cabrera
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Jacob,

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

  3. jacobdubail
    Member
    Posted 1 year ago #

    Thanks Hector! Much appreciated!

    -Jacob

  4. jacobdubail
    Member
    Posted 1 year ago #

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

    -J

  5. jacobdubail
    Member
    Posted 1 year 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. Héctor Cabrera
    Member
    Plugin Author

    Posted 1 year 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

About this Topic

Tags

No tags yet.