Support » Plugins » [Plugin: Shorten2Ping] solution to strip html in post /page title

  • 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


Viewing 5 replies - 1 through 5 (of 5 total)
  • 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 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).

    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!

    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).

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

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

    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).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Shorten2Ping] solution to strip html in post /page title’ is closed to new replies.