WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Twitter Tools] twitter->blog cut off at 30?? (2 posts)

  1. huwr
    Member
    Posted 5 years ago #

    trim_add_elipsis($tweet->tw_text, 30)

    why?! it makes the titles ugly and unhelpful. this should atleast be a user defined value, no?

    it should probably also use a simple regex to strip urls out of the title if there is enough regular text.

  2. Xerotone
    Member
    Posted 5 years ago #

    Agreed. I cobbled this together from some other code I found lying around. Set $length to whatever you wish... it shouldn't break words.

    $length = 60; $replacer = '...';
    		if(strlen($tweet->tw_text) > $length) {
    			$tw_text = (preg_match('/^(.*)\W.*$/', substr($tweet->tw_text, 0, $length+1), $matches) ? $matches[1] : substr($tweet->tw_text, 0, $length)) . $replacer; } else {
    			$tw_text = $tweet->tw_text;
    		}
    		$data = array(
    			'post_content' => $wpdb->escape(aktt_make_clickable($tweet->tw_text))
    			, 'post_title' => $wpdb->escape($tw_text)
    			, 'post_date' => get_date_from_gmt(date('Y-m-d H:i:s', $tweet->tw_created_at))
    			, 'post_category' => array($this->blog_post_category)
    			, 'post_status' => 'publish'
    			, 'post_author' => $wpdb->escape($this->blog_post_author)
    		);

Topic Closed

This topic has been closed to new replies.

About this Topic