Category Archives: CSS

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.

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!! πŸ˜€

Websites being converted to Standards mode and my struggles with it.

Well, (why I do I start everything I start talking about with “Well”.. well, I don’t know) I decided this week to try and convert the www.pelicar.info site from using frames for its presentation to DIV containers and CSS to achieve the same thing as best I could. In the end, I think I have achieved this. The website still has a left-hand menu that stays in place while scrolling the main contents. Also, the address bar will actually show the proper URL for the page and if you do a browser refresh, the current page will display again and not go back to the home page. Before, to refresh the main content, you had right-click within that frame and then choose refresh. Most folks are not accustomed to doing that, however. This also makes bookmarking a specific page much easier and is a bit more compatible with search engines.

Luckily, no-one is using older browsers such as IE5 or at least very few. When they scroll on the page the menu will go up along with everything else. Another thing that changes are some layout/rendering differences. The reason.. it has to do with the difference between Quirks and Standards mode. In fact, depending on the DOCTYPE of the page, IE6 and 7 can be made to function in Quirks mode or Standards mode. Following are a couple resources that explain the differences:

Quirks Mode vs Standards Mode – overview
The Box Models – Standard vs Quirks

So, in Quirks mode the border and padding are inside the Width you give an element which means you are giving it the width that everything should take up, while in Standards mode the border and padding are outside the Width you give to an element. Here you are specifying the width of the content only.

This difference in the box model caused some issues dealing with paragraphs that contain italicized text. I kept noticing some pages had a horizontal scroll bar at the bottom of the page for apparently no reason that would only scroll for a couple pixels… nothing was extending past the right edge. I was going nuts loco. I also noticed that as I narrowed the browser window where a paragraph contained some italics and was flowing around a picture, the picture would sometimes jump below the paragraph! (Here’s that page) Googling around, I stumbled upon this article: IE and Italics. I had to add a style to combat it:

/* Doing overflow:hidden to correct IE and italics rendering issues */
P {
  overflow: hidden;
}

There might be a better way as this does cause it to chop the text off.. but it stopped the weird behavior for now. Changing the padding on my divs might solve it but I was tired of messing with it after that worked.

Another thing I changed was to use relative font sizing instead of fixed point or pt sizing. Well, this opened up another can of worms I wasn’t expecting. There was a page that contained several table (the New Creatures page) and I had defined the TD element with this style:

TD, TH { font-family: Arial; font-size: 0.80em; }

Which makes the font 80% smaller than the main body font which is 1.0em (by the way em refers to the size that a capitol letter “M” takes up). But, the text in one table looked much smaller than it should. Well, as it turns out, that table had a table within a table on the left, and the right had text explaining the items in the table. The text everywhere was too small. Turned out to be a problem of inheritance. This page explains it: Relative font sizes and inheritance. Since the font of the first TD was reduced by 80%, that is now considered the base font size for everything in that element. The nested table caused its text to be further reduced another 20%. I fixed the problem with the nested table by doing the following:

TD, TH { font-family: Arial; font-size: 0.80em; }
TD TD, TD TH { font-size: 1.0em; }

This keeps the nested TD element with the same base TD size of 0.80em instead of reducing it again. To fix the normal text that I did not want to be reduced in size by the initial 80% I made its TD element like this:

<td STYLE="font-family: Times New Roman; font-size:1.0em;">

Problems solved! πŸ˜€

I am also in the middle of changing my main website to run in Standards mode as well and cleaning up some of the 15 year old coding in some places… like closing paragraph tags and other things LOL. I don’t know if I can keep it looking the same if I get rid of the frames, namely due to the embedded media player in the bottom-left frame. Just don’t think there’s a way without frames to keep a song playing around while browsing, unless the player is loaded in a separate pop-up or browser window which I don’t really like. Hmmmm.. Anyway, all for now I guess.