Updates to the site

Well, it has been some time since I’ve made any updates to the site.  I initially used a theme that gave a portfolio look to the site.  Unfortunately it was a little hokey, so I wanted to update it.  In the last year I also picked up a new hobby and a wife, in that order.  The wife-to-be had an interest in screen writing, so I decided that I would take over a Meetup group that would help me help her get a screen play published.  Since I took over The RTP “Let’s Make a Movie” Meetup Group, I have done two movie projects and am currently working on the third.  So, I decided that I would add movie work on this site as well.  With that in mind, a overhaul was needed.

The first thing I needed to do was fix the theme.  I found a couple I liked, but they broke the code highlighter.  I stumbled upon this theme by RedEvolution, which had a nice color and handled things well, until I installed it.  I figured since it was most of the way there, I would just alter it to get it all the way to my needs.  Initially there wasn’t anything in the theme to prevent Pages that were at the top level from showing, that I didn’t want to show.  I altered the header file that creates the Page navigation to only show the pages that I want. The change of code was inserting the include and sort order values to the page list call.

<div id="user3">
<ul><?php wp_list_pages('depth=1&include=1,2,3,4&sort_column=ID&sort_order=DESC&title_li='); ?></ul> 
</div>
<!--user3-->

Next on the agenda was adding my logo image to the top of the site. The theme display the Blog Title without an option to add a personalized logo. I’m sure there is a plugin to do this, but I found some code to easily alter the header information to add the logo on the WordPress Forum. The thread was two years old, but the code was still valid. The change to the header file adds a div class for the logo, while leaving the Blog Title available to be placed by the style sheet.

<div class="logo"><h1 class="offscreen"><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1> 
	<div class="bubble"><p><?php bloginfo('description'); ?></p></div>
</div>

The style sheet changes help place the Blog Title off of the visible page and sets the background image of the div to the logo image file residing in the images directory. I also had to do some creative padding to get the logo and Blog Tagline to show in the right place.

.logo{
	position:relative; 
	z-index:1;
	background: url(images/header-logo.png) no-repeat top left;
	padding:12px 0 0 0;
}
.offscreen {
	font-size: 0;
	text-indent: -999em;
}
.bubble p{
color:#fff;
margin:0;
padding:0 0 0 30px;
}

Finally, I initially wanted my logo to change whenever the Category or Page changed. For example: if the Films Page was selected, then the logo would change to the DeanLogic Films logo. Unfortunately I haven’t gotten it all sorted out. I did manage to update the header to display the Category Description and Image for the selected Post. This code change to the header file can be found under the WordPress Codex. Simply just cycle through each of the categories for the post and get the Category Description and Category Slug. Then you will need to upload images to correspond with the image name created from the slug. For multiple categories, just append each description and image code together.

$catCount = 0;
	foreach((get_the_category()) as $category) { 
		if($catCount == 0){
			$catAbout .= $category->category_description;
			$catImage = '<img src="' . get_bloginfo('template_directory') . '/images/' . $category->category_nicename  . '.png" align="right" alt="' . $category->cat_name . '" />'; 
		} else {
			$catAbout = $catAbout . '&nbps;&nbps' . $category->category_description;
			$catImage .= '<img src="' . get_bloginfo('template_directory') . '/images/' . $category->category_nicename  . '.png" align="right" alt="' . $category->cat_name . '" />';
		}
		
		$catCount++;
	}

	$pageContent = $catAbout;

I will probably just create a image for each Page, since the Categories don’t match up exactly to each of the Pages. I initially wanted them to match up, but it didn’t work out logically for me. And while I was typing up this post the solution came to me. I did a search and found a way to get the Category information from the page slug parsed from the URI. It took me a couple of searches, but I finally found good example of using get_term_by. From this information, I updated the header file to include a step if the category was not found due to being a Page and not a Post.

if($catCount == 0){
		$catSlug = current( explode( '/', trim( $_SERVER['REQUEST_URI'], '/' ) ) );
		$tempCategory = get_term_by('slug', $catSlug , 'category');
		$catName = $tempCategory->name;
		$catImage = '<img src="' . get_bloginfo('template_directory') . '/images/category-' . $catSlug . '.png" align="right" alt="' . $catName . '" />';
		$catAbout = $tempCategory->description;
	}

I also had to make a small adjustment for when the site is on the home page. It tends to grab the first post category, so I have a check to see if there’s no URI length and then provide the text from the About Page. Here is the final code.

if(strlen($catSlug) < 1){ 
		$pageData = get_page_by_path('about');
		$catAbout = apply_filters('the_content', $pageData->post_content); 
	} else {
		foreach((get_the_category()) as $category) { 
		if($catCount == 0){
			$catAbout .= $category->category_description;
			$catImage = '<img src="' . get_bloginfo('template_directory') . '/images/category-' . $category->category_nicename  . '.png" align="right" alt="' . $category->cat_name . '" />'; 
		} else {
			$catAbout = $catAbout . '&nbps;&nbps' . $category->category_description;
			$catImage .= '<img src="' . get_bloginfo('template_directory') . '/images/category-' . $category->category_nicename  . '.png" align="right" alt="' . $category->cat_name . '" />';
		}
		
		$catCount++;
		}
	
		if($catCount == 0){
			$tempCategory = get_term_by('slug', $catSlug , 'category');
			$catName = $tempCategory->name;
			$catImage = '<img src="' . get_bloginfo('template_directory') . '/images/category-' . $catSlug . '.png" align="right" alt="' . $catName . '" />';
			$catAbout = $tempCategory->description;
		}
	}

Now all I have to do is make some better Category / Page images and start adding information from the films.

A little clean up

Well, I was getting a little annoyed with the look of my blog and forum, so I decided to do a little clean up.

The theme I was using on the blog was called Life Is a Byte. For one reason or another, the site I got it from is no longer available. After adding the cloud widgets and some other things, I noticed that it was behaving badly on IE. Well, I wouldn’t recommend IE to my mother, so it really wasn’t a big deal. However, I did want to get it fix, so I went searching for a new theme that was similar to what I had. My thought was, I could find a similar theme and just fix the problems in the old copy, paste and steal method of the web. Well, as you can see at the bottom of each page, I found the original theme site that my old theme was based off of.

i3Theme apparently is the “most downloaded Mac theme”, according to the site MangoOrange. Well, I like mangoes, so I have no problem that it’s supposed to be a Mac theme, I just want it to work with my blog. If you look at the site, you’ll notice that the theme comes in bright blue, dark blue, red pink and green. As you can tell by my site, I did a little alterations to one of those version. I took the red version and changed the background images to fit my darker theme. If you look very closely, you’ll notice that it’s not completely black. Unfortunately, I couldn’t copy the swoosh look they have on the colored versions, so I just did some hue alterations and left it at that. It works for what I want.

The great thing about using the original theme is that the background images in the side panels now works. Of course, that means I need to go back into the cloud widgets and make the backgrounds transparent. I am happy with how it looks in FireFox, but IE has decided that it won’t work with the theme. And, it’s not just my site, because MangoOrange has the same problem when viewed through IE. I guess they figure their users for Opera, Safari or FireFox fans.

After getting that straightened out, I did a little tweak to the Forum. The biggest problem with using WordPress for the main site and phpBB3 for the forum, is there are no good links between the two. So, I can’t stick the forum inside the blog and use the blogs theme. Also, I a member can’t register in the blog and also be registered in the forum. I tried to use a hack that would do that, but it about blew up my site. So, the most I can do is use a theme close to the one I am using on WordPress. The one I found is called ProNight. The base theme is called ProSilver, so I guess that’s how they came up with the name. After getting the new theme on the blog, I took the background image and replaced the header image on the forum. Then I added a link back to the main site (you have to do that, because there is no built-in link back to the main page). To clean things up, I removed a small site logo and change the font of the forum description. I think it fits in nicely with the site, but gives the user a slightly different look, so that they know they are on the forum and not the main site.

I also made some updates to my WP People plugin for the blog.

Little by little, I’m getting things done.