• Hello.

    I need to add a with content to the title of the posts when they have a specific WordPress tag assigned.

    I have used this code:

    add_action( 'the_title', 'add_sold_tag_on_title', 10, 2 );
    function add_sold_tag_on_title( $title, $post_id ) {

    if( has_tag( 'sold', $post_id ) ) $title = "<span style='color: #fff; background-color: #a86500; margin-right: 10px; font-size: 0.5em; padding: 5px 15px;'>SOLD</span>" . $title;

    return $title;

    }

    In single post it works correctly and the formatted text is displayed. But in the blocks of your plugin, such as Post and Page Grid, the html code is displayed, it is not interpreted:

    Screenshot: https://postimg.cc/phpjyQpf

    How do I solve this? Thanks

    • This topic was modified 1 week, 5 days ago by efquintana.
  • You must be logged in to reply to this topic.