Category Archives: Website Update

Blog Updated to WordPress 3.3 and Other Website Changes

WordPress 3.3 was just released and I’ve completed upgrading my blog. Nothing to it really. Just clicked the update button and it did the rest. πŸ™‚ Well, I did back-up the database and directory structure before starting the process.Β  I also had to do my usual code tweaks to vars.php and wp-login.php that I do with every upgrade.

They also updated the Twenty Eleven theme to version 1.3; however, since I am using a Child Theme, I lost none of my changes and after doing a file comparison it looks like nothing has changed within the files that my child theme is using, such as header.php.

I also added a GetGlue widget (to find these, go to the Widgets section of your account settings) to both my blog and main website, and updated the Twitter widgets on both as well. After adding the newer Twitter widgets I needed to adjust some of the CSS to allow for a wider side-bar and also widened the main content area of the blog’s main page while I was at it. There was more empty space between the two than there needed to be. I also adjusted the appearance of the H3 header tag when used in the context of a post. It looks cool as a widget title in the side-bar but was getting lost in posts as it’s smaller than the normal text. Anyway, it looks fine now:

H3 header tag In a post.

Here’s the changes I made in my theme’s style.css file to make these changes:

#content {
   /* margin: 0 34% 0 7.6%; */
   margin: 0 34% 0 3.8%;
   /* width: 58.4%; */
   width: 62.4%;
}

#primary {
   margin: 0 -29.4% 0 0;
}

#secondary {
   /* margin-right: 7.6%; */
   margin-right: 3.8%;
   /* width: 18.8%; */
   width: 25%;
}

.entry-content h3, .comment-content h3 {
   font-size: 100%;
   font-weight: bold;
}

Now I need to figure out how to get WordPress’s post editor to look the same. πŸ™‚ But, I think I’m going to go play EverQuest II right now.

Gallery Upgraded to Version 3.0.1

A couple days ago I upgraded my Gallery to version 3.0.1. The process wasn’t quite as easy as it is to upgrade my blog these days in that it’s not just a simple point-and-click operation. Even so, it did go without issue as I understood how I needed to go about it. My process was as follows, which closely follows these upgrade instructions:

  1. Backed up the current database and files (I had modified several of the core code files so wanted to make sure I saved everything for later comparison).

  2. Created a new temporary directory both locally and on the server that would receive all the updated code before switching it to the live version.

  3. Copied over my customized .htaccess, robots.txt, favicon.ico, php.ini, local.php and other necessary files that I use into the new directory.

  4. Downloaded the Gallery 3.0.1 code and extracted it locally. I then removed the included .htaccess and robots.txt files so they would not overwrite my custom ones. I then re-zipped the files into the proper directory structure for my situation.

  5. Uploaded and extracted these files into the new directory I had made on the server.

  6. Copied over the /var directory to its corresponding location in the new directory I made in step 2.

  7. Changed my theme within the Gallery admin section to the default theme so that when I switched directories, it would have a theme to load as I knew I would be re-doing my custom theme based off the new default.

  8. I went to gallerymodules.com to make sure I had the latest versions of the 3rd-party modules that I use, several of which did have newer versions. I extracted the modules locally and combined them all into a single MYMODS.ZIP file to upload to the server. I then extracted these into the /modules directory of the new gallery directory I had created.

  9. Renamed my gallery directories such that the new code would be active and ran the upgrade script. It updated both core and 3rd-party modules that needed to be. The new gallery code was then active and everything seemed to work fine.

At this point it was time to re-create my theme with the new Gallery default Wind theme as the base and add back the various code tweaks I had made over time if needed. Rather than go into any code specifics with this post, I will make separate posts as warranted, most notably about how to not count views by the Gallery admin. πŸ™‚

Gallery Changed to Gallery 3.0 Code.

Now that Gallery 3.0 Final has been released, I have changed my main Gallery to use it. This wasn’t an overnight thing as I have been using the Gallery 3 code in a test environment since it was in beta. Notice I did not say upgrade, but change. This is a completely new code base from Gallery 2. None of the modules or themes from Gallery 2 are compatible. Why the change? Well, the main reason is that working with the code in this version is so much easier. The database schema is also much easier to comprehend and deal with.

Because of this change, I did have to change how I get a random image from the Gallery to display on my blog and main website. It was fairly easy to make the switch. Because the database schema was easier, I was able to just do a direct database connection and MySQL query to get the information I needed. No inclusion of gallery code or use of Curl connections was necessary. A much more efficient process that took an averageΒ  of 0.2 seconds off the page load time for my blog!

The other fun part has been locating all the links and image references that needed to be changed. Think I have updated all of them in my blog and main website. For the external links I’ve been modifying the .htaccess file as situations arise. Here are few examples:

   # put redirects for old to new gallery links here
RewriteBase /
RewriteRule ^v/MyPics/HomeTheater/([A-Za-z_0-9\)\(\-]*)\.[A-Za-z]*\.html$ http://gallery.markheadrick.com/Home-Theater/$1 [R=301,L]
RewriteRule ^v/MyPics/([A-Za-z_0-9\)\(\-]*)\.[A-Za-z]*\.html$ http://gallery.markheadrick.com/MiscPics/$1 [R=301,L]
RewriteRule ^v/Nature/([A-Za-z_0-9\)\(\-]*)\.[A-Za-z]*\.html$ http://gallery.markheadrick.com/Nature/$1 [R=301,L]

The current (default) theme that the Gallery uses is heavy in JavaScript use. I’ll keep my eye out for a suitable theme that doesn’t use as much JavaScript; however, it’s really not that bad. Besides, customizing the themes in this version is much easier and since the final code was just released, it’s probably best to stay with the default theme for now. Actually, I do tend to use the default themes most of the time since they are guaranteed to be the most compatible with the latest core code.

Since this version works with Akismet, I have opened this gallery up for comments for now. I had to turn them off in the other one due to overwhelming amounts of spam at times even with captcha modules installed. So feel free to comment. πŸ™‚

I guess that’s about it for now. Hope you had a happy 10/10/10! πŸ™‚

Blog has been upgraded to WordPress v3.0!

I have upgraded my blog to WordPress v3.0 which was just released a couple days ago. As I always do, I backed-up all my files and database before proceeding. I have a local copy of my blog on the PC so I upgraded it first. I did the auto upgrade option again which seemed to have worked well. Even so, once again I had to edit the /wp-includes/vars.php file to force $is_apache to true (see below) since the SERVER_SOFTWARE variable comes back as WebServerX instead of Apache.

// Server detection

/**
 * Whether the server software is Apache or something else
 * @global bool $is_apache
 */

//$is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? true : false;
$is_apache = true;
/**
 * Whether the server software is IIS or something else
 * @global bool $is_IIS
 */

$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;

I also had to edit the /wp-login.php file and add session_start(); at the beginning for the Register Plus plug-in to work properly as PHP sessions are not automatically started at my webhost (I could make them auto-start if I wanted but I’d rather have control of it via my scripts):

session_start();
/**
 * WordPress User Page

Now I could have stopped here; however, I wanted to use the new default WordPress theme, Twenty Ten which had a wider footprint and additional functionality beyond the previous default theme. I also figured it would be the most stable and up-to-date theme to work with the new WordPress version.Β  I made of a copy of the theme and placed it into its own directory, giving it my own name.

Since this was a new theme, I had to modify some of the PHP files to add my custom code. All I really had to do was add a JavaScript code snippet to the /mytheme/header.php file that some of my archived pages use to show and hide parts of their content. I also had to add a piece of code to the /mytheme/comments.php file for the Math Comment Spam Protection plugin to function; however, this theme’s coding of the comment form was much different and from what I could tell would have to do a lot of hacking around with the code to get it to work. So, I decided to look for something else. I came across the Block-Spam-By-Math plugin. This one worked with the new theme and I didn’t have to add any additional code anywhere to make it work! During this time frame where I did not have a functioning Math protection plugin, Akismet caught around 55 spam comments! This was in less than a day and a half. Since adding in the new plugin, Akismet has only seen one new spam comment. This just proves how many spam comments a plugin like this will stop.

Update: August 24, 2010: The Math Comment Spam Protection is now compatible with WordPress 3.0.1 and have switched my blog back to using it.

At this stage all I’m really doing is playing around with CSS styles to get the blog to appear how I want. This is where things like Firebug for Firefox come in real handy by telling me where an element is getting its style from. It will tell you about the element’s inheritance, which file(s) contain the CSS, and the line numbers within those files. By the way, I found the CSS Tutorials at W3Schools to be rather helpful in testing out various font-size and line-height combinations which this theme seems to use heavily. I may change its use of fixed pixel sized line-heights in favor of relative values so that they scale properly with changes in font size, we’ll see. πŸ™‚

Before I close and while there’s still 30 minutes left in the day, I just wanted to wish my dad and all the other dads out there a Happy Father’s Day!! πŸ˜€

Modified Navigation Links to not Show Daily Tweets.

Update: October 7, 2015: In case anyone finds this post, thought I should mention that I quit using that Advanced Category Excluder plugin. Read my Excluding Categories from Different Parts of WordPress post for how I currently do it. Also, here’s the actual code to exclude the categories I wanted from the links:

<?php
$mrh_exclude = '61, 74';
?>
...
  <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title', false, $mrh_exclude ); ?></span>
  <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>', false, $mrh_exclude ); ?></span>

I’ve modified the code in my blog’s theme to exclude the Daily Tweets category (aka Twitter Digest) from the Previous and Next post navigation links when viewing a single post. This will make it behave more like my blog’s home page and feed where that category is also excluded via the Advanced Category Excluder plug-in. So, to view the posts in that category, you will need to click on the Daily Tweets category on the right-hand side of the blog under the Categories section.

I decided to do it this way rather than using the plug-in to exclude the category from “single posts” as that would prevent the ability view the post individually (it causes a 404 error to be generated).

Now, the Daily Tweets will not get in the way of browsing the normal posts on my blog. πŸ™‚