Category Archives: WordPress Theme

How to Customize Your 404 WordPress Page

When setting up a WordPress blog, most individuals never stop to think about customizing their 404 page. The 404 “Page Not Found” page error displays when one of your blog visitors attempts to access a broken link or non-existent webpage. Taking the time to customize your 404 page, leaving a more helpful message than the standard page not found message, can greatly benefit your visitors and keep them coming back to your website.

The default template, accessible when you first set up your website or blog, contains a 404.php file, which will display the standard page not found message to your visitors. However, not all WordPress templates contain a template file for 404 page errors. In a few easy steps, you can add a 404 page, or simply customize the existing 404 page so that it displays a more user-friendly message to your visitors. Continue reading

Adding Pagination To Your WordPress Blog Page without using a Plugin

You can add pagination to your WordPress blog home page without using a page navigation plugin. Simply add the following piece of PHP code to where you want to show the pagination (preferably in your “index.php” file near the footer).

The HTML Code

Paste the following code to where you want to show the pagination

<div class="my_page_navi">
global $wp_query;
$total = $wp_query->max_num_pages;
if($total > 1) {
if ( !$current_page = get_query_var('paged') ){$current_page = 1;}
$perm_structure = get_option('permalink_structure');
$format = empty($perm_structure) ? '&page=%#%' : 'page/%#%/';
$paginate_return_data = paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
'current' => $current_page,
'total' => $total,
'mid_size' => 4,
'type' => 'plain'
echo $paginate_return_data;

The “type” plain parameter will create a simple plain pagination. You can specify type “array” to get all the pagination links so you can display them how you want to.

The CSS Code

Now, all you need to do is add some CSS to your theme’s CSS file (style.css) to make the pagination look prettier. Add the following CSS code to your theme’s CSS file (customize it to suit your needs):

.my_page_navi {margin: 5px 0;display: block;margin:10px 0px;}
.my_page_navi .page-numbers{padding: 3px;border: 1px solid #9E9E9E;background: #EDEDED;margin:0px;font-size:12px;text-decoration: none;font-weight:bold;}
.my_page_navi a{color: #0071bb;text-decoration: none;position: relative;}

Turning a Web Template into a WordPress Theme

Breaking the Mold by Turning a Web Template into a Standard WordPress Theme

WordPress counts more than 60 million users among its ranks, with a development community that numbers in the tens of thousands. Given statistics as impressive a these, it’d be easy to assume that the number of themes available for WordPress installations is as limitless, diverse, and impressive as the number of users who call the software their own. But that’s actually not true, as the design and development community at large seems to have settled into several easily-identifiable patterns when crafting themes for this content management titan. Indeed, a casual glance through any WordPress theme directory website reveals that most sites are comprised of two or three columns, a large header and footer, and the same tired typefaces and font families that have been used for years on blogs all around the internet.

One great way to bypass this seeming limitation of style is to forego the WordPress theme directories altogether and choose a theme from a regular web design directory. Web designers around the world are designing outstanding templates for websites not powered by WordPress, leaving out the PHP code in favor of placeholder text, and encouraging users to do their own handiwork to make the design come alive with content. This might sound intimidating, especially to those new to the WordPress software or XHTML and PHP in general. However, with a few simple steps and general guidance from the WordPress Codex and developer community, it’s easy to turn any web template into a robust WordPress theme. This process generally concerns “slicing” the theme into a header, footer, and content area, and injecting WordPress variables into the code to bring dynamic content to the otherwise-static page. Here’s how the process works.

Step 1: Defining the Header, Content Area, and Footer

Almost every WordPress theme splits the design into three content areas, which include the header and footer as well as a main content area. This main content area includes the published posts as well as at least one sidebar, and sometimes two. Though to goal is to achieve a design which visually breaks the mold of typical WordPress offerings, this basic three-part structure should still be followed as it’s the best way to ensure that dynamic content is pulled in the same way throughout the website. Using these three sections helps ease the process of titling pages, ending code, placing a copyright, and ensuring that there is a certain ease of use to the website.

The first step will be pulling the header out of the template file. Open up the template’s main design file (probably an “index.htm” filename or something similar). In that document, highlight everything from the very top of the file through to the end of the navigation elements. This will likely include meta tags, page title information, navigation, a masthead or header image, and a few script or CSS inclusions. This information should then be cut-and-pasted into a new, blank text file. Save that file as “header.php” and close it.

Next scroll down to the end of the file. Find the last line of code, indicated by a < /html > tag, and highlight everything from that closing tag up to the end of the main content area (likely the < /div > tag which closes the sidebar or content column). Cut that code and paste it into a new, separate text file. Save that file as “header.php” and close it.

Finally, with the remaining code, go to the text editor’s “File” menu and choose “Save As.” Save the file as “index.php” and close it. The template has now been sliced into the three key parts of any WordPress theme and it can now be easily managed and modified as variables, PHP code, and dynamic content are all added into the mix.

Step 2: Turning a Static Header into a DynamicWordPress Header

The theme’s header will be one of the easiest files to modify, as its code will require just a few small adjustments and additions. The easiest way to begin modifying this template is to add the actual “wp_head” tag. This simple tag is responsible for including the WordPress version number and other important information into the header when the page is rendered using the WordPress software. Simply paste the following tag into the header file right after the < head > tag:

<?php wp_head(); ?>

Next, the page must be styled using the theme’s stylesheet file using WordPress variables. First and foremost, rename the downloaded web template’s included stylesheet file to “style.css,” which is the widely-accepted standard name for the stylesheet included with a WordPress theme. Next, include the following meta tag in the file to call the stylesheet (and delete any similar tag which may have been inserted by the original theme developer):

<link rel="stylesheet" href="< ?php bloginfo( 'stylesheet_url' ); ? >" type="text/css" />

The important thing in the above tag is the actual PHP variable, which tells the theme to pull the stylesheet from the relative theme root folder rather than from a hardcoded server path. Finally, it’s time to place WordPress variables in the actual < title > tag so that the blog name and page title can be dynamically placed into it for display to end users. Here’s what that looks like:

<?php wp_title(-); ? > < ?php bloginfo( 'name' ); ?>

These two tags should be placed between < title > and < /title >. The first one displays the actual post or page title while the second one is responsible for printing the name of the blog. They can be arranged in any order and the hyphen placed into the “wp_title” tag can be defined as any ASCII character to serve as a separator between the blog and page title elements.

These are the last of the WordPress variables to be placed into the header. Developers will want to change the navigation area to reflect the site’s structure, as these links may not line up with those defined by WordPress. Make sure the home, archives, about me, and other links go to the proper pages within the site.

Step 3: Filling in the Web Template’s Footer Information

Most web templates are designed to give the original theme developer some credit in the footer area, often pairing it with a link to the author’s site, a copyright, and other links such as those to the wider template directory. It’s fine to keep these in the footer, especially since free themes (and free theme developers) rely on these referral links to generate future business. They can be removed by the end user as their tastes demand, however, and that process should be completed first.

After the content in the footer has been updated to the satisfaction of the WordPress administrator, it’s time to place one simple variable into the footer so that WordPress can place its own basic copyright information (both printed on the page and included in XML tags behind the scenes). This is done by including the following tag:

<?php wp_footer(); ?>

With this included, and the administrator-desired information placed into the footer, the alteration of this template is now complete. It can be saved and is ready to upload to the server.

Step 4: Bringing WordPress Content to the Main Index File

Two things are now necessary to complete the actual XHTML elements of the content area of the web template. Those two things will see dynamic WordPress content brought into the sidebar area, and will enable the display of published content on the page. The sidebar is, without a doubt, the easiest thing to modify and bring up to WordPress standards. Start by highlighting all of the existing static code in the sidebar < div > area and cutting it. Then paste that information into a new text file, saved as “sidebar.php.” Eliminate any content that should not make it into the final theme, and then paste the following variable below that content. This variable will allow the placement of dynamic WordPress widgets below the hardcoded static content.

<?php if ( function_exists ( dynamic_sidebar() ) ) : ?>

With that variable added to the sidebar content, the “sidebar.php” file itself is now complete and can be saved. It is now ready to be uploaded to the server. All that remains is the standard WordPress sidebar inclusion variable which will serve to bring the sidebar’s content into the main index page. The variable below should be pasted into the same < div > element that the static sidebar content was just removed from:

<?php get_sidebar (); ?>

The sidebar area is now complete and focus can shift to the main content area of the website. This is where the content from pages and posts will be displayed and it requires inclusion of the standard WordPress Loop in order to make that happen. A standard WordPress Loop is given in the example below, but it’s important to note that this is an exceedingly simple version of what is often considered the “heart” of WordPress programming. There are many more variables which can be used, and a combination of XHTML and CSS can be used throughout the loop to give it a truly stunning appearance on each page as the author wishes:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<h2> <?php the_title(); ? > </h2>

<span> <?php the_date(); ?> </span>

<p> <?php the_content(); ?> </p>

<?php endwhile; else: ?>
<span><?php _e('There are no posts here! Go back and try again?'); ?></span>
<?php endif; ?>

With this code placed into the file, it should now be saved as it is ready for upload to the server. Also, since this template will also work to display categories, archives, single entries, and user-created pages, it should be saved with the following file names using the “Save As” feature in the “File” menu:

– archive.php
– category.php
– page.php
– single.php

With all of the PHP files updated with WordPress variables and completely saved, the web template is just one simple step away from becoming a regular WordPress theme, capable of handling any content the software throws at it. That simple step involves modifying the “style.css” file created earlier in this tutorial so that it’s header includes basic theme information. This information will allow the theme to be seen by the WordPress Dashboard, allowing administrators to view, preview, and activate it as they wish. Here’s how that process is completed.

Step 5: Turning the Stylesheet into a Theme Identification Document

Every WordPress theme is identified using “commented” lines of CSS code in the theme’s “style.css” file. This method has been used since the early days of WordPress and has proved so effective, and so easy to use, that it was also adapted to site plugin files for their identification in the Dashboard as well. Each line of this information needs to be filled out, and authors should do their best to fill everything in as accurately and fully as they can. It only helps to identify the theme and set it apart from the others once uploaded to the server. Here’s the commented CSS code which will need to be altered:

Theme Name: Web Template Theme
Theme URI:
Description: Place a brief description of the theme in this area, as it will be displayed in the Dashboard itself and will help identify the theme to administrator users.
Author: Your Name
Author URI:
Version: 1.0
Tags: list, creative, tags, which, describe, the, design elements, of the, theme, separated by commas

This information, once completed, gets placed into the “style.css” file immediately at the top of the document. This means it appears before any actual CSS code is added to the document. Failure to include the information in that way will see it completely ignored by the Dashboard. The immediately consequence of this is that the theme will not be displayed in the Dashboard at all, rendering it unable to be activated until the problem is remedied.

Step 6: Bug Test and Activate the New WordPress Theme

Developers need to avoid making a common mistake: Overestimating their ability to correctly copy code and custom-create a WordPress theme on the first attempt. Even the most seasoned developers have been known to make mistakes, and that means that an effective bug test is the key to ensuring a theme’s high quality and usability. Be sure to preview the theme in the Dashboard before activating it; after activating it, browse the website and make sure that everything is displayed properly and according to plan.

If everything looks as great in real life as it did when the web template was first downloaded, then the process is complete and a new, unique WordPress theme will grace the appearance of a blog which almost fell victim to uninspired, uniform WordPress-targeted design.

Images Displaying Too Big or Small When Using the WP eStore and Thesis Theme

When using the WP eStore and Thesis Theme you may run into the issue of your images displaying too big or small. There is a simple fix for this as I will explain in this cheat sheet.

The Thesis theme specifies a width for the input fields in it’s theme CSS. This makes it so images have a specific size and will cause them to be stretched  or smooched.

To fix this issue all you need to do is override the CSS of the theme by adding the following CSS code in the Custom CSS file of the Thesis Theme.

.custom .format_text input {
width: auto;

To add this to the Custom CSS file of the Thesis them all you need to do is click on the “Custom File Editor” menu from your “Thesis Options” menu and paste the CSS code I provided above.