• I post all my non-reply tweets from Twitter on my personal blog with Twitter Tools. I do not display the posts with the Twitter Tools widget, but with SideBlog. With SideBlog you can place all posts from a particular category in the sidebar. I have chosen to show only my “Tweets from Twitter” category. The original output of SideBlog places a title, post content and a permalinked “#” at the end of the post. This wasn’t minimalistic enough, and on top of that with Twitter Tools the first 40 characters of your content is your title, so you are repeating yourself. I don’t care for the pound sign, “#”, either. So I made the following changes to the plug-in.

    Edit One
    This edit comments out all the SideBlog plug-in’s output except for the permalink and the content. You will find this code within SideBlog 5.1 at about line 170 within the function, sideblog($asidecategory=”).

    // smjdesign BEGIN edit
    	      $replacements[] = $sideblog_content->post_title;
    	/*      $replacements[] = wpautop($sideblog_content->post_content);
    	      $replacements[] = "<a href=\"" . $permalink . "\">#</a>";
    	*/
    	      $replacements[] = "<a href=\"" . $permalink .
    	"\">".
    	format_if_content_contains_link($sideblog_content->post_content);
    	/*      $replacements[] = “<a href=\”" . $permalink . “\”
    	title=\”" . $sideblog_content->post_title . “\”>” .
    	$sideblog_content->post_title . “</a>”;
    	      $replacements[] = $sideblog_content->post_date;
    	      $replacements[] = “<a href=\”" . $permalink .
    “\”>” . $sideblog_content->post_date . “</a>”;
    	      $replacements[] = $excerpt;
    	      $replacements[] = $excerpt2;
    	*/
    // smjdesign END edit

    Edit Two:
    Place the function, format_if_content_contains_link(), within sideblog.php. I have placed around line 200 after function, sideblog(). This function tests to see if the post content contains a link. There are better (non Regular Expression) ways to do this with PHP5. This function is needed to make content that contain links valid HTML (or XHTML). If not used, links tags will encapsulate other links tags.

    // smjdesign BEGIN edit
    	function format_if_content_contains_link($content) {
                if( substr($content, strlen($content)-4 , 4) == "</a>" ) {
                            $content_arr = split("<a href",$content);
                            $content = preg_replace(
                            "/<a href/", "</a><a href", $content, 1);
                }
                else {
                            $content .= "</a>";
                }
                return ($content);
    }
    // smjdesign END edit

    You can view the output of these changes in the sidebar at my personal site, Rachel and Stephen.

    Originally posted at DesignWell.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I did this, it created fatal errors.

    I see how to change # to whatever else you want, but, I can’t seem to get tweet titles to go away either on twitter-tools.php or sideblog.php

    ideas?
    raging-beginner speak please.

    I figured it out.
    Instead of messing with sideblog, I went into twitter-tools.php and on line 477 I found this: , 'post_title' => $wpdb->escape(trim_add_elipsis($tweet->tw_text, 30))

    delete that line, and you delete twitter titles completely

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: SideBlog] Remove titles and pound sign and link content to permalink’ is closed to new replies.