WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Shorten2Ping] solution to strip html in post /page title (6 posts)

  1. bookwormthefishman
    Member
    Posted 4 years ago #

    Hi
    I am using version 1.2.2 of your plugin Shorten2Ping
    After using it I noticed that it didn't strip any html in the post /page title, which is allowed in wordpress,to aid with menu formatting
    the solution is to add strip_tags() on line 59 of shorten2ping.php

    <br />
      if (!empty($short_permalink)) echo "<a>post_title)."\">" . $linktext . "</a>";<br />

    and line 90

    <br />
       $post_title = strip_tags(get_the_title($post_id));<br />

    I hope that you find this suggestion useful

    You have developed a great plugin that just works
    Thanks

    Ian

  2. Samuel Aguilera
    Member
    Posted 4 years ago #

    Thank you for your support, but... why you would want to put html tags in the title of a post? (pages are not notified by Shorten2Ping). And anyway, WP doesn't make that filter in the post title, so I dont know why you want that Shorten2Ping to do it for you.

    Maybe that you really wants is a fix for removing special html entities from the title when using Ping.fm to notify new posts (not happened with Twitter). (i.e. Showing 'Test...' instead of 'Test…').

    That is already fixed for the next Shorten2Ping release (pretty soon).

  3. bookwormthefishman
    Member
    Posted 4 years ago #

    Hi
    thanks for your reply
    but for several reasons
    Good programming practice, since wordpress accepts html tags in both page and post titles, and doesn't strip them from the titles to allow site themes to selectively style the titles when they are displayed on websites.
    having hmtl tags in the post title allows users selectively style how post titles are displayed in different areas of web pages,
    eg. a shorter version in navigation list of posts or even the showing the shorter version in the h1 tag on the page whilst allowing the full version of the post title to be displayed in the pages title tag (embeded html tags removed with a override function in the themes functions.php file

    it might help if I gave you an example

    post title stored in database : <span>Sites Name </span>November 2009 <span>Club </span>Newsletter
    which will display in the html page title : Sites Name November 2009 Club Newsletter

    then for example the sites theme could style the posts list, with css so that only:
    November 2009 Newsletter

    is displayed, the site theme could be designed to display either the long or short version depending on the requirements of the sites owner

    if you don't strip html tags these are passed to the query string passed which is sent to ping fm, encoded as html entities, ping fm then passes these to the target application eg facebook which displays these entities in the automated posts,which as you know will look html in the post

    Even if you don't agree with this methodology, since you are accessing the raw post data as it returned from the database into wordpress, it makes sense to protect your plugin's users from themselves!
    yours
    Ian

  4. Samuel Aguilera
    Member
    Posted 4 years ago #

    Ok, you win ;)

    But only because of the last part of your post "it makes sense to protect your plugin's users from themselves!".

    I'll add the strip_tags to the next release of Shorten2Ping (no date set yet).

  5. tuviere
    Member
    Posted 4 years ago #

    I installed Shorten2Ping on my blog, configured it and have posted several articles several but none shows up on Ping.fm or at my myspace, twitter or facebook.

    I don't know what am doing wrong can someone please help me please

  6. Samuel Aguilera
    Member
    Posted 4 years ago #

    Well... your post is not related at all with this topic... but, anyway, please check your config for the plugin and check if your hosting meet all the requirements (see readme).

Topic Closed

This topic has been closed to new replies.

About this Topic