Support » How-To and Troubleshooting » [Resolved] Cut off long post_title

[Resolved] Cut off long post_title

  • Hi all,

    Firstly, apologies as I know this has been asked before but I can’t quite get any of the suggested ideas to work, so I’m hoping somebody will be kind enough to lend a hand.

    I display the latest five posts on a page external to my blog, however when you get a long post_title it can mess up the appearance. I would like to turn.

    “WordPress is a great tool for those who like to blog”
    “WordPress is a great tool for those…”
    (cut off after 35 characters and insert “…”)

    Here is my current php code, which works (but displays full titles)

    mysql_connect("******.******.******.***", "******_******", "******") or die(mysql_error());
    mysql_select_db("wordpress_blog") or die(mysql_error());
    $data = mysql_query("SELECT * FROM wp_posts WHERE post_status='publish' ORDER BY post_date DESC LIMIT 0, 5") or die(mysql_error()); while($info = mysql_fetch_array( $data )) 
    Print "<font color='black' face='arial'><li><a href='/blog/?p=".$info['ID'] . "'>";
    Print $info['post_title'];
    Print "</a> <font color=#666666><i> - posted on ";
    $date = date('j M \'y', strtotime($info['post_date']));
    Print $date;
    Print "</i>";

    The code that needs changing is:
    Print $info[‘post_title’];
    but to what I do not know.

    Hope somebody can help.


Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Cut off long post_title’ is closed to new replies.