Tag Archive
2.7 8.10 9.04 9.10 100th acquisition advertising amd aol apache apple assp ati beta black hole blog browser bug building business caching callback CAN-SPAM can spam act centos chrome clamwin code collider comments compression computer css datacenter delayed development digg documentation earth Edward W. Felten email encryption encyclopedia of life enery eu exploit family fatherhood fedora firefox first plugin folding@home free freeware game Gaming gaming_rig gimp google guides hardware header history home house HPN-SSH icann IE image improvement Infoworld intel Internet ipv6 IT jail kubuntu ldap Leap Day lhc Linux locked files mac mail_server malware me memory microsoft misc money mouse moved Mozilla msdn mysql network solutions nvidia oem open-source os paint_shop_pro patch pc pentium phising php plugin post post-revision protocol ram RC record release review rollover safari samba scammers science SCP screenshots script script kiddies security SEO Series server service pack society software son Sony SP3 spam species squirellmail SSH storage stupidity styling sun tape tech Techozoic theme threaded tip tips ubuntu Unix update utility video card virtualization vista vlite vmware vsphere web weird WHS windows windows 7 wordpress work worm wsus XP xray
Wordpress Theme Options Framework Ver 2
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.
Dynamic Stylesheets using PHP
Recently while doing some work on my theme for WordPress I came across a very helpful idea. Using PHP in a stylesheet to make it more dynamic. The basic idea is to use PHP variables and define certain elements that repeat in various places such as a color code to make it easily changeable by only having to change one line instead of searching for and replacing multiple times. Other examples are fonts, images, widths, even whole sections of code could be shown or hidden with the use of variables and an if statement.
Optimize your WordPress theme for Search Engines – Part 3
This is the 3rd and final post about SEO for your WordPress theme. Meta keywords used to be what all search results where based on but over time webmaster began abusing this to gain rank, today some say that they are ignored all together when calculating search results but if they’re not then having your posts tags and categories added couldn’t hurt. This is the code goes between the <head> </head> tags. This also includes the meta description code from yesterday’s post.
<?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<meta name="description" content="<?php $excerpt = strip_tags(get_the_excerpt());
echo $excerpt; if ( $cpage < 1 ) {}
else { echo (' - comment page '); echo ($cpage);} ?>" />
<meta name="keywords" content="
<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ','; }
$posttags = get_the_tags();if ($posttags) {foreach($posttags as $tag) {echo $tag->name . ','; } } ?>" />
<?php endwhile; endif; elseif(is_home()) : ?>
<meta name="description" content="<?php bloginfo('description'); ?>" />
<?php endif; ?>Line 5 thru 7 are the ones that deal with the keywords.
<meta name="keywords" content="
<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ','; }
$posttags = get_the_tags();if ($posttags) {foreach($posttags as $tag) {echo $tag->name . ','; } } ?>" />
This code depends on the loop code on line 1 to be able to pull the posts category and tags. This code basically pulls each category out and prints it out follow by a comma and then does the same with the tags. The comma is important because that is what separates the keywords. Even if this has marginal benefit it’s not that hard to implement and the cost as far as page load time should be minimal.
You see the whole series here. Be sure and rate each post, thanks.
Optimize your WordPress theme for Search Engines – Part 2

Today I’m showing how to add your meta descripition to your blog. Google will use this as the description that shows up in it’s search results which can help with click through if you write good excerpts about your posts. If you don’t have a specific excerpt written then wordpress automatically grabs the first 55 words which may or may not be very descriptive of your post. It’s always a good practice to manually write your excerpt to give a summary of a post.
First I’ll post the code that needs to go into your header.php file between the <head> </head> then I’ll explain the pieces and what the do
<?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<meta name="description" content="<?php $excerpt = strip_tags(get_the_excerpt());
echo $excerpt; if ( $cpage < 1 ) {}
else { echo (' - comment page '); echo ($cpage);} ?>" />
<?php endwhile; endif; elseif(is_home()) : ?>
<meta name="description" content="<?php bloginfo('description'); ?>" />
<?php endif; ?>
The if (is_single() || is_page() ) determines if the current page is a single post or a single page. Next is this if ( have_posts() ) : while ( have_posts() ) : the_post(); this is mini loop to pull in the excerpt for the current post or page. Next this code pulls the excerpt and strips any html tags from it to display a clean excerpt $excerpt = strip_tags(get_the_excerpt()); echo $excerpt;. After that is the comment page code again to elimanate duplicate meta tags with google if ( $cpage < 1 ) {} else { echo (' - comment page '); echo ($cpage);}. The last bit of code is if it's just the home page then the tagline from the blog is displayed. That's it for section. Tomorrow I'll go over how to add your tags and categories to the meta keywords, some say search engines don't pay much attention to these but it doesn't hurt to have them. You can follow the whole series here. Be sure and rate each post, thanks.
Optimize your WordPress theme for Search Engines – Part 1
Recently I was updating my themes, and I got to thinking about SEO a little and about how to apply it to a theme to help out the blog author. One of the biggest complaints with WordPress 2.7 is the comment pagination and duplicate content. Google detects the comment pages as duplicate even when the comments are different. The easiest thing is to append comment page N to the title and meta description. To do this you need to edit the header.php of your theme and add this between the <title> </title> tags.
<title><?php if ( is_single() ) { wp_title(''); if ( $cpage < 1 ) {}
else { echo (' - comment page '); echo ($cpage);} ?> | <?php } ?><?php bloginfo('name'); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if ($paged > 1) { echo " - Page $paged"; } ?></title>
I’ll explain the code now. The first if finds if it is a single post or page then it prints the title of the post or page first then the second if finds if its a comment page then it appends – comment page 1 and so on to the title. Next is the | which serves as a separator for the title of the post and title of the blog. Next the name of the blog is printed then next comes some code to find if the current page is a older posts page and if it is then it prints Page 2 and so on. This is also to eliminate duplicate title tags. Tomorrow I’ll go over how to pull an excerpt and make it the meta description which is also helpful for your search rank. You can follow the whole series here.
