• Hi,

    I noticed that the Hitmag Pro theme (tested it with 1.1.18) does not strip HTML tags from the post Title when it comes to share the post to social networks such as Twitter, Facebook & more using the built-in Social Sharing feature.

    The issue becomes relevant when you install plugins who (properly and legitimately) add HTML tags within the h1.entry-title element, such as the “Subtitles” plugin:

    https://www.ads-software.com/plugins/subtitles/

    In very short words, the fix should be to replace the following line within the /inc/template-tags.php file:

    $hm_post_title = str_replace( ' ', '%20', get_the_title() );

    with the following:

    $hm_post_title = str_replace( ' ', '%20', the_title_attribute('echo=0') );

    This workaround will effectively fix the issue for good, as the_title_attribute('echo=0') correctly escapes the title and also strips all the HTML tags, which is definitely a good practice for a social sharing feature (for the post title, at least). Therefore, I strongly suggest you guys to apply that fix in your Hitmag and Hitmag Pro themes.

    For additional info regarding get_the_title() and the_title_attribute() WordPress functions, take a look at the following URLs:

    [ Redacted ]

    I sincerely hope that this post will help other developers like me who will stumble upon this issue!

    • This topic was modified 6 years, 7 months ago by Darkseal.
    • This topic was modified 6 years, 7 months ago by Darkseal. Reason: Syntax highlighting
    • This topic was modified 6 years, 7 months ago by Jan Dembowski.
    • This topic was modified 6 years, 7 months ago by Darkseal.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Thanks for the help but please don’t send people to your site. If you want to share the solution then feel free to share it here.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I just noticed this part.

    I noticed that the Hitmag Pro theme (tested it with 1.1.18)

    For pro or commercial product support please contact the author directly on their site. This includes any pre-sales topics as well.

    As the author is aware, commercial products are not supported in these forums. I am sure they will have no problem supporting you there.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hitmag Social Sharing not stripping HTML tags from Title’ is closed to new replies.