Social Bookmark Widget 0.3 QuickFix
Social Bookmark Widget is a sweet widget by darxr whichs puts bookmark-buttons for a huge number of social bookmark services on the sidebar. It lets you choose what sites to display from a list which seems to include every major (and even minor) social bookmarking site out there, you can make the box have 20 icons or just select the few services you want.
However, version 0.3 of this widget has a pretty serious bug: It puts the wrong post title in the links to the social bookmarking sites. Why? I don’t know why. The default code to get the title is:
$post_title = get_bloginfo();
$post_title .= wp_title(’-', false);
And this should work. wp_title() gets the correct post title when used in header.php, and other files used by themes, but for some reason it takes the title of the last post on the front page and uses that as the post title. So someone presses a button to bookmark a page on your site and the social bookmark service they use will display the title of some early post you’ve made instead of the title of the post they went from.
Is this a bug which applies to standard WordPress as well? I don’t know. But it does happen with WPMU v1.1.1.
Here’s a fix: Open /wp-content/mu-plugins/widgets/bookmark/bookmark-sites.php and replace the above mentioned two lines of code (which starts at the second line of that file) and replace it with this:
if (is_home () ) {
$post_title = get_bloginfo();
} elseif ( is_category() ) {
$post_title = get_bloginfo();
$post_title .= single_cat_title(’ - ‘, false);
} elseif (is_single() || is_page() ) {
$post_title = get_bloginfo();
$post_title .= ‘ - ‘;
$post_title .= single_post_title(”,false);
} else {
$post_title = get_bloginfo();
}
There is one issue with the elseif (is_single() || is_page() ) { section you may want to consider; if your site’s title is long and your post’s title is long then the combination may be too long for some bookmarking services. You may be better off just using $post_title = single_post_title(”,false); instead of the three lines (which pust the blog’s title first, a - in between and the post’s title at the end) - which is my preference, anyway. This is also how almost all posts on Digg are shown: Just the post title, there’s no “BlogName - PostTitle” there, only PostTitle.
How to make this blogging community website
I happened to stumble upon this post in the WPMU forums:
I would like to have a main blog, that is nothing but blurbs from the recent posts in the sub blogs. A “recent posts” type front page that lists only X recent posts from all blogs that Mu manages. If as an admin I could post complete blog items to the front page as well that would be rad.
When something is posted to a sub blog, I would like it to post something like:
TITLE OF NEW POST — from some sub blog
..and that’s what I wanted on this site - except I wanted to show the entire contents of the latest blog posts and not only the introduction to it. So I wrote my own little plugin called “STREATCOWPMU - “Show The Recent Entries And Their Content On WordPress MU”. Now it’s available for download.. mostly because somebody asked for something like this.
Many of the WPMU tweaks used at LivelyBlog are just strait-off-some-site downloaded extentions who are downloaded and installed, but there are a few who are changed signifficantly, bugfixed or customized. Many off these should probably be made available to the public, so they will be, immediately or eventually.
That’s what this blog will be about: How this site is made and the PHP code used to make it.