Archive results for:

WordPress Tip: Styling for Specific Page

An easy way to have styling for unique Pages is via CSS on the unique page id that is generated for every Page in WordPress:



WordPress Tip: Templating Posts vs Pages

Posts and pages have a lot in common, and although most themes will have separate templates for these, they rarely differ all that much.

First of all, as with every template that deals with the things between the header and footer, you need to include said header and footer. This is done with the get_header() and get_footer() template tags. Read more ›

WordPress Tip: Archives

Archives in WordPress usually means category, tag, or even date-based archives. There are dedicated template files for all of these, should you want precise control over tag archives (tag.php) or category archives (category.php), but chances are you think all these should look and feel the same. Then you can use archive.php instead, which is the fallback for all kinds of archives.

Basically, the archive.php template file consists of a heading (the visitor needs to know where they are on the site after all), what kind of archive it is that they are viewing, and a loop that outputs the archive contents as defined in the read settings in WordPress.


WordPress Tip: index.php

A required template file in WordPress themes is index.php.

The idea is that this is the theme’s last line of defense, the template file that’ll be used if no other ile its. In other words, if the theme doesn’t have a category.php file, and WordPress wants to render a category archive, then the system will look for others.

First it’ll check for archive.php, the fallback for archives, then it’ll go back to index.php, the final fallback. Treat index.php that way, and make sure it returns something.


WordPress Tip: Sidebar.php

The sidebar.php file usually  consists of only minimal markup needed for outputting the widgets in the side-column widget area, which was registered in functions.php. You can do that with dynamic_sidebar(), and by passing the ID of the widget area wanted, which is side-column, again as registered in functions.php.

This means that the sidebar.php is pretty straightforward to say the least.

You can also have conditional sidebars (i.e. this site), that change content based upon what page/post is being requested.