• Resolved Renlong

    (@renlong)


    Dear thaikolja,

    First of all I would like to thank you for your contribution to this plugin. However, there is a detail here that needs to be resolved: When I use PHP code “get_the_title()” (for mail sharing), the title of mail will automatically output the HTML code:

    Title text <br> <span class=’class-subtitle’>subtitle text </span>

    However, this appears the HTML codes would be inappropriate on the title of the email. Only plain text is needed. The correct text format should be:

    Title tet: Subtitle text

    Can you please help me to fix it? Thank you and have a good day.

    PS: Similar problems also appear in the previous case https://wordpress.org/support/topic/hide-htmlstyling-markup-from-social-share/

    • This topic was modified 2 years, 11 months ago by Renlong.
    • This topic was modified 2 years, 11 months ago by Renlong.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author thaikolja

    (@thaikolja)

    Hi @renlong,

    Thanks for your kind words, and for taking the time to bringing this issue here.

    So, basically, you’d like to get the “raw” title in PHP while still using Secondary Title’s “Auto show” function?

    If that’s the case, you’d have to access the post as an object. Like this (untested):

    $posts = get_posts(['post_type' => 'post']); // Your individually queried posts
    foreach($posts as $post) {
       echo "This is " . $post->post_title;
    }

    Or did I misunderstand your question? If so, please explain it a bit further so we can find a solution for you 🙂

    • This reply was modified 2 years, 11 months ago by thaikolja.
    Thread Starter Renlong

    (@renlong)

    @thaikolja

    Dear thaikolja, I am much grateful for your patient reply, I know that the spirit of selfless dedication is priceless.

    One of the most important issues I found in use, the %title%%secondary_title% in plug-in Secondary Title automatically turn the subtitle into part of the title in HTML structure. In my case, this output result will have an HTML tag. This nature causes some problems when sharing the article (I have sent an email to you, I believe the screenshot above may explain more clearly.).

    If after using the code get_the_title() (Or other similar code), the plugin outputs the original title, instead of the conversion title (which combined %title% and %secondary_title%), this problem may be alleviated. (HTML code should not appear in the title of sharing articles). Are you interested in implementing the feature get_the_original_title()?

    Anyway, thank you for your dedication and time. Take care, and I hope you have a pleasant day.

    Best regards,
    Renlong

    • This reply was modified 2 years, 11 months ago by Renlong.
    • This reply was modified 2 years, 11 months ago by Renlong.
    Plugin Author thaikolja

    (@thaikolja)

    You can always turn off “Auto show” and use PHP instead. Without “Auto show”, it only appears where you place the PHP code <?php echo get_secondary_title($post_id); ?>.

    I’m currently building a full documentation for all features under https://docs.thaikolja.com/secondary-title/ which might be of help.

    If you have more ideas, please go ahead, I’m always up for improvements.

    Thread Starter Renlong

    (@renlong)

    This looks a better workaround, I will have a try. Best

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Solution to removing HTML / DIV characters in social share’ is closed to new replies.