Posts vs Pages

Most themes use separate files to display posts and pages rather than using index.php for both. There are simple changes, like removing the category and tag listings from the page display or moving the date tag (or removing it altogether). There are many other changes you could make, though. For example, you could use the conditional tags if_page() and if_single() in your sidebar to display different widget areas for posts and pages. That way, you can display post-related things like archives, categories, and tag clouds only on your post archives and use the page sidebars to list the page's children (if it has any) or media attachments. Listing 6-22 shows a sidebar.php file that includes various sidebars depending on the type of page being viewed.

Listing 6-22. A sidebar.php file that calls other sidebar files conditionally

<div id="sidebar">


Was this article helpful?

0 0

Post a comment