Archive for the 'Internet' Category

How To: WordPress 3.0 Multi-site Blog Directory

I’ve been using this WordPress page template lately for creating a directory page. The directory page lists every blog on a WordPress 3.0 multi-site setup and includes the author name, author bio, number of posts, last updated time, and gravatar. One thing it DOES NOT include is recent posts. I will get around to adding that in a few weeks. It also lists the 5 most recent posts for each blog.

I like using the 1kb css grid system for laying pages out, so you can see what I use for css in the zip file. If you want to roll with that setup, you can just copy and paste the contents of css.css into the style.css file for your theme. And move sign.png into the images/ folder for your theme. You’ll also want to do something with the blog-directory.php file.

blog-directory.php is a custom page template for Twenty Ten. If you’re using the Twenty Ten theme, you can just drop blog-directory.php into the “twentyten” theme folder and be done. If you’re using another theme you’ll need to open blog-directory.php and copy everything between <!– start blog directory –> and <!– end blog directory –> and paste it into a custom template for your theme.

If you’re not familiar with custom page templates in WordPress, you can read about them here.

Download blog-directory.zip

Twitter: Embed Tweets in Your Blog or Website

Today I discovered Blackbird Pie, by way of a post on Noscope.

Blackbird Pie is a tool provided by the Twitter Media team that allows you to embed tweets directly in your blog posts or any website really. Here’s a good description of Blackbird Pie from a post at media.twitter.com:

The origin of the script is both self- and user-centered. Mostly, we just think it’s a pain to take screen grabs of tweets. But of course we also think it’s a much better user experience to have @-mentions, hashtags and the account itself all linked and clickable.


This is my 6000th tweet. Oh, and Blackbird Pie (http://bit.ly/9WG6vd) is cool!less than a minute ago via CoTweet


The tweet above is an example of what Blackbird Pie does, definately much better than having to take a screenshot and post the tweet that way. All you have to do is provide the URL to the tweet and Blackbird Pie will spit out code for you to post in your blog or website. Now you can actually link directly to the tweet and the tweets author, and have the tweets content visible to search engines, something not possible with screenshots alone. Hashtags and @ mentions are also linked.

It’s a neat tool, sure to be of use to folks who like to embed tweets in their site. Blackbird Pie is a way better option for embedding tweets compared to simply taking screenshots of tweets.

How To: Build a Tag Cloud with PHP, MySQL, and CSS

Tag clouds are everywhere. They are a popular way to show the weight (read: popularity) of tags, categories, or any words really. I needed to build a tag cloud for a project at work to display categories and show how many questions were contained inside each category. Categories with more questions would need a larger font, and categories with fewer questions would need smaller fonts. I came across this post from Steve Thomas titled How to make a tag cloud in PHP, MySQL and CSS.

Steve’s code is exactly what I was looking for. I made a few modifications to his code and wrapped it all into a custom PHP function, which you can see below.

Download The Code

The function returns an array that contains each category name, the CSS class that should be applied to the given category, and the category ID for linking to the page showing only questions in that category.

<?php
function tagCloud($maximum=0) {
	$cats = array(); // create empty array

	$query = mysql_query("SELECT categories.catDesc, categories.catId, COUNT( questions.id ) AS totalQuestions FROM questions, categories WHERE questions.categoryId = categories.catId GROUP BY categories.catId;");
	while ($row = mysql_fetch_array($query)) {
		$cat = $row['catDesc'];
		$counter = $row['totalQuestions'];
		$catid = $row['catID'];

		// update $maximum if this term is more popular than the previous terms
		if ($counter> $maximum) $maximum = $counter;

		$percent = floor(($counter / $maximum) * 100);
		if ($percent <20) {
			$class = 'smallest';
		}
		elseif ($percent>= 20 and $percent <40) {
			$class = 'small';
		}
		elseif ($percent>= 40 and $percent <60) {
			$class = 'medium';
		}
		elseif ($percent>= 60 and $percent <80) {
			$class = 'large';
		}
		else {
			$class = 'largest';
		}
		$cats[] = array('term' => $cat, 'class' => $class, 'catid' => $catid);

	}
	return $cats;
}
?>

You’ll also need some CSS to style your tag cloud. This CSS is pretty much identical to what Steve published, I only made some minor changes to font sizes.

#tagcloud {
    width: 300px;
    background:#FFFFCC;
    color:#0066FF;
    padding: 10px;
    border: 1px solid #FFE7B6;
    text-align:center;
}

#tagcloud a:link, #tagcloud a:visited {
    text-decoration:none;
}

#tagcloud a:hover, #tagcloud a:active {
    text-decoration: underline;
    color: #000;
}

#tagcloud span {
    padding: 4px;
}

.smallest {
    font-size: 10px;
}

.small {
    font-size: 12px;
}

.medium {
    font-size:14px;
}

.large {
    font-size:16px;
}

.largest {
    font-size:18px;
}

To use the function, do something like this:

<div id="tagcloud">
<?php
$tagCloud = tagCloud();
foreach ($tagCloud as $t) {
	$cat = $t['term'];
	$class = $t['class'];
	$catid = $t['catid'];
	print "<a href=\"category.php?id=$catid\">$cat</a>";
}
?>
</div>

I am still testing this code, but so far it seems to do exactly what I need it to do. If you experience trouble with the code or if it doesn’t act as expected, please let me know in the comments. If you’ve got ideas on how to improve the function, I’d love to hear your thoughts as well!

WordPress 2.9.2

WordPress 2.9.2 was released earlier today. You can download it here. This fixes a problem that allows users that are logged in to view trash posts authored by other users.

Thomas Mackenzie alerted us to a problem where logged in users can peek at trashed posts belonging to other authors. If you have untrusted users signed up on your blog and sensitive posts in the trash, you should upgrade to 2.9.2. As always, you can visit the Tools->Upgrade menu to upgrade.

Thomas Mackenzie goes into much greater detail about the problem on his site. Check his site out for more info on why the 2.9.2 release was necessary.

WordPress Theme: Unwakeable 1.5.3

Unwakeable 1.5.3 is available for download. This version is built off K2 1.0.3 and should work beautifully with WordPress 2.9+. You can head over to the Unwakeable page to get the download, or you can grab it here.

K2 1.0 added more support for WordPress 2.9. For example, K2 1.0 supports new WordPress features such as post thumbnail images. One of the more noticeable changes to K2 since the 1.0 release is the absence of SideBar Manager (SBM). It sounds like it was simply too much work to maintain SBM, and was beyond the scope of what K2 is:

It’s worth mentioning that the last remnants of the old SideBar Manager, or SBM, have now been removed from the codebase. It started out as a fully-fledged replacement for WP’s lacking widgets system and ended up as a patch-of-sorts to the widget system, allowing for widgets to be placed only on specified pages. But in the end, while the native widget system is still very much in need of an update, it didn’t feel right for K2 to try and cover that particular area of the administration interface. And besides, other plugins for doing just that exist already.

So instead of spending our time patching that system for an ever-changing WordPress, our time is probably better spent on more theme-specific functionality, like the rolling archives or livesearch systems, as well as keeping up with new WordPress features, like for instance Post Thumbnails.


Rather than break down all of what’s changed in recent versions of K2, I’m going to make it easy on myself and direct you to the K2 1.0 release announcement. Just know that Unwakeable 1.5.3 sports all the features found in K2 1.0.3. You can comment on this post or on the Unwakeable page with questions or comments.

WordPress 2.9.1

WordPress 2.9.1 was released a little over two weeks ago. You can download it at the usual location.

From the release announcement:

This release addresses a handful of minor issues as well as a rather annoying problem where scheduled posts and pingbacks are not processed correctly due to incompatibilities with some hosts. If any of these issues affect you, give 2.9.1 a try. Download 2.9.1 or upgrade automatically from the Tools->Upgrade menu in your blog’s admin area.

WordPress 2.9.1 came less than a month after WordPress 2.9.



Phoenix SEO - search engine optimization - SEO Company India - Quick Diets
Hawaii Interior Design - Compare The Market - Security Gates
Phoenix Internet Marketing - Miami Web Design - Web Design - SEO India - Scrap Gold
Industrial and Commercial Roofing - Steel Beam London and RSJ Beams - SEO Services