Code Snippets

No Titles After Importing Blogger To WordPress

I imported an old Blogger account into a WordPress blog recently and my titles did not import correctly. So there I was stuck with 500 posts with no titles. I decided the easiest way to fix that would be to copy the post dates from the Blogger account to the titles in WordPress. So here is a fairly quick and dirty way to import qd_db_posts.post_date to qd_db_posts.post_title.

This will all be completed from your OS shell which in this case was CentOS 5.2.

Technology Insights

WordPress: Display Pages Marked Private To All Users

When I was initially attempting to do this it was because I did not want to display a majority of the WordPress pages I was creating in the navigation or in the Pages Widget. After some research I located information on the WordPress Codex about how to exclude certain pages however this was not going to work for me since I would constantly be having to modify the exclude list with hundreds more than if I could just include the pages I wanted to show in the navigation. Inside the [wp-root]/wp-includes/widgets.php  file you can make a small modification followed by a change via the WordPress admin GUI.

Code Snippets

Create A Easy Three Column Grid Using CSS

I am by no means a CSS guru but I definitely have to do my fair share. Last night I was struggling with creating a three column grid with multiple rows inside of another div. Everything I was trying ended up blowing out of the sides of the original div or no matter what I tried I was unable to get the image and text within each chunk of the grid to line up properly. Below is the HTML file with the CSS built in for easy testing and then it can be picked apart to use however you see fir. This was definitely the most helpful way for me to integrate with my other templates once I was able to visualize it in the most simple manner.

Technology Insights

ZenCart Search Button Image Not Displaying

I installed ZenCart recently for a project I am working on and was playing around with the default design including switching some of the buttons around. I noticed that the search sidebox search button was not displaying. After a little bit of digging around I noticed an error in the code. The file that needs to be modified is the <zencart-root>/includes/templates/template_default/sideboxes/tpl_search.php template as noted below.

[quickcode:Old tpl_search.php]
* Side Box Template
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license GNU Public License V2.0
* @version $Id: tpl_search.php 4142 2006-08-15 04:32:54Z drbyte $
  $content = “”;
  $content .= ‘<div id=”‘ . str_replace(‘_’, ‘-‘, $box_id . ‘Content’) . ‘” class=”sideBoxContent centeredContent”>’;
  $content .= zen_draw_form(‘quick_find’, zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, ”, ‘NONSSL’, false), ‘get’);
  $content .= zen_draw_hidden_field(‘main_page’,FILENAME_ADVANCED_SEARCH_RESULT);
  $content .= zen_draw_hidden_field(‘search_in_description’, ‘1’) . zen_hide_session_id();

  if (strtolower(IMAGE_USE_CSS_BUTTONS) == ‘yes’) {
    $content .= zen_draw_input_field(‘keyword’, ”, ‘size=”18″ maxlength=”100″ style=”width: ‘ . ($column_width-30) . ‘px”‘) . ‘<br />’ . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
    $content .= ‘<br /><a href=”‘ . zen_href_link(FILENAME_ADVANCED_SEARCH) . ‘”>’ . BOX_SEARCH_ADVANCED_SEARCH . ‘</a>’;
  } else {
    $content .= zen_draw_input_field(‘keyword’, ”, ‘size=”18″ maxlength=”100″ style=”width: ‘ . ($column_width-30) . ‘px” value=”‘ . HEADER_SEARCH_DEFAULT_TEXT . ‘” onfocus=”if (this.value == \” . HEADER_SEARCH_DEFAULT_TEXT . ‘\’) this.value = \’\’;” onblur=”if (this.value == \’\’) this.value = \” . HEADER_SEARCH_DEFAULT_TEXT . ‘\’;”‘) . ‘<br /><input type=”submit” value=”‘ . HEADER_SEARCH_BUTTON . ‘” style=”width: 50px” />’;
    $content .= ‘<br /><a href=”‘ . zen_href_link(FILENAME_ADVANCED_SEARCH) . ‘”>’ . BOX_SEARCH_ADVANCED_SEARCH . ‘</a>’;

  $content .= “</form>”;
  $content .= ‘</div>’;


It should actually look like the below.