4 - Feb

Server Migration – Part 1

Before this week, my server that handles this website was beginning to show signs that it need a fresh start. It’s currently running CentOS 4.4, so I decided it’s time to upgrade. So I grabbed the latest DVD iso from CentOS for 5.4 and installed a clean virtual machine on my desktop. I’ve just finished migrating everything from the old server to the virtual machine. I’ve also done away with the cobbled together mail solution of sendmail, dovecot, and assp I had running in favor of a very nice open-source Exchange-type replacement called Zimbra.

The next step after a couple of days of testing will be wiping the old drive in the old server and installing VMWare ESXi on it. I decided to virtualize to make it easier to upgrade in the future when I decide to build a new desktop. I’ll retire my current desktop and recommission it as the new server and having everything virtualized should make the transition much smoother. I’m hoping downtime will be minimal if any at all.

While developing my Techozoic theme, I’ve progressed from adding custom CSS into the head section, to having an external file and using $_GET variables to pull options from the database, to now I believe is the right way to do it, using add_filter and a custom query in WordPress. By using this new method I’ve done away with unsafe $_GET variables and can now use any builtin WP functions in the external file.
First you’ll need to edit your functions.php file and add this block of code.

	add_filter('query_vars', 'add_new_var_to_wp');
	function add_new_var_to_wp($public_query_vars) {
		$public_query_vars[] = 'my_theme_custom_var';
		//my_theme_custom_var is the name of the custom query variable that is created and how you reference it in the call to the file
		return $public_query_vars;
	}

This sets up WP to now accept a new variable in a query called my_theme_custom_var the format of the query would be http://www.yourblog.com/index.php?my_theme_custom_var=css . The ? mark tells WP that this is a query and the = sign tells what the query variable should be set to.
Now to actually setup the function that will call the external file. I found this gem when looking at how popular WP theme called Atahualpa handled it’s external CSS.

	add_action('template_redirect', 'my_theme_css_display');
	function my_theme_css_display(){
		$css = get_query_var('my_theme_custom_var');
		if ($css == 'css'){
			include_once (TEMPLATEPATH . '/style.php');
			exit;  //This stops WP from loading any further
		}
	}

This code now will check if a query is passed to WP with the value my_theme_custom_var and if it is and has the value of css then it includes the style.php file which is our dynamic CSS file. Then the code exits which stops any other functions from happening other wise the whole home page is outputted along with the style.php file, which isn’t what is needed only the file.
Now you can use any WP functions on the style.php file as it is included from the functions.php file which is a standard WP file.
Source : Will Norris

1 Star2 Stars3 Stars4 Stars5 Stars |  (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

As I’ve worked more on my theme and increased my coding skills I’ve added to my original theme option framework. I’ve become more aware of best practices of coding and WordPress, a big issue with the original framework was the way options were added to the wp_options database table. Each theme option got it’s own entry in the table, this might be okay for small theme, but I’ve grown to over 40 different options in my Techozoic theme. It was time to optimize, with the new framework the entries added to the wp_options table went from 40 to 2. I’ll continue below with code examples and explanations. As an added bonus I’ve included an example of how to pull your theme options into a external stylesheet, based off of this concept.

Read more »

1 Star2 Stars3 Stars4 Stars5 Stars |  (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

Ubuntu 9.10 Released

By Jeremy Clark   Filed In Linux  |  Tagged , , ,

ubuntulogo Ubuntu the Linux distro from Canonical has released a new version 9.10. The biggest new features are Firefox 3.5 and access to “Ubuntu One“, online storage space. Every user gets 2GB of free space for backup and sharing. Of course access to thousands of applications and games is available through the software center as well. This release was focused on beautification of the desktop rather than major feature inclusion.

The server edition wasn’t overlooked though, it now includes Ubuntu Enterprise Cloud. Organizations that use Ubuntu Server can now take advantage of cloud computing.

1 Star2 Stars3 Stars4 Stars5 Stars |  (1 votes, average: 4.00 out of 5)
Loading ... Loading ...

ApacheAfter reading this article dealing with “bulletproofing” a blog, I started looking at my own blog. Over the past few months as more and more great plugins come out that I depend on now, my page load times had started suffering. A load time of 14 seconds on a T1 was not unheard of, and it could get as bad as 20 seconds on some days. The article by Eric Amundson had a link to a couple of Firefox plugins that looked promising in helping diagnose ailing websites. One is Page Speed from Google. The other from Yahoo! called YSlow.

Read more »

1 Star2 Stars3 Stars4 Stars5 Stars |  (3 votes, average: 3.67 out of 5)
Loading ... Loading ...