Using a Keyword Plugin with Google Blog Bar

As much as I love the functionality of the Google Blog Bar in my blog, there is a limitation. Since my code to add the Blog Bar uses the post’s category for the keyword search, if the category is something like “Miscellaneous Musings/Moments“, there will be no results because the Blog Bar searches through the post’s content, and ignores the category.

I decided to find a WordPress plugin that would enable me to apply tags to my posts. Tags are better than categories when the number of posts don’t warrant having a category for the posts. Also, I don’t have to display the tags so there won’t be clutter.

I decided upon Jerome’s Keywords Plugin because it is possible to use the categories that I have already assigned to the posts. I didn’t want to have to go back and enter keywords for all my posts.

There will still be posts that don’t have blog bar results, but this new functionality allows me to have more flexibility with what results should show up.

If you want to use the Blog Bar in the same way that I am:

  1. Install Jerome’s Keywords Plugin
  2. Follow instructions in my blog post, Added Google Blog Bar to Individual Posts
  3. Replace the code in the previous step with the following:
/* Only edit the variables here */
$key = 'YOUR-API-KEY';
$site = '';
/* end of editable portion */
function the_category_plain($separator = '', $parents='') {
	echo '"' . strip_tags(get_the_category_list($separator, $parents)) .'"';
<h2>Google Blog Bar</h2>
<p>The blog bar presents posts from my blog with related keywords. If none are found, Google posts are displayed.</p>
<!-- ++Begin Blog Bar Wizard Generated Code++ -->
  // Created with a Google AJAX Search Wizard

  // The Following div element will end up holding the actual blogbar.
  // You can place this anywhere on your page.
  <div id="blogBar-bar">
    <span style="color:#676767;font-size:11px;margin:10px;padding:4px;">Loading...</span>

  <!-- Ajax Search Api and Stylesheet
  // Note: If you are already using the AJAX Search API, then do not include it
  //       or its stylesheet again
  // The Key Embedded in the following script tag is designed to work with
  // the following site:
  <script src="<?php echo $key ?>"
  <style type="text/css">
    @import url("");

  <!-- Blog Bar Code and Stylesheet -->
  <script src=""
  <style type="text/css">
    @import url("");
#blogBar-bar a img {
	border: none;
}  </style>

/* use in the loop
ttt: modified version of the_post_keytags() from Jerome's keyword plugin
function post_keytags($include_cats=false, $localsearch=true, $linktitle=false) {
	$taglist = get_the_post_keytags($include_cats, $localsearch, $linktitle);

	if (empty($taglist))
		return "none";
		return ucwords(strip_tags($taglist));
$keywords = post_keytags('include_cats');
$keywords_list = eregi_replace ( ', ', "', '", $keywords);
  <script type="text/javascript">
    function LoadBlogBar() {
      var blogBar;
      var options = {
	    siteRestriction : "<?php echo $site ?>",
        largeResultSet : true,
        title : "Related Posts",
		cycleTime : GSblogBar.CYCLE_TIME_LONG,
		currentResult : document.getElementById("currentResult"),
        horizontal : true,
        orderBy : GSearch.ORDER_BY_RELEVANCE,
        autoExecuteList : {
          executeList : [<?php echo "'" . $keywords_list . "'" ?>]

      blogBar = new GSblogBar(document.getElementById("blogBar-bar"), options);
    // arrange for this function to be called during body.onload
    // event processing
  <div id="currentResult">Loading</div>
<!-- ++End Blog Bar Wizard Generated Code++ -->

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>