[wp-hackers] Custom Page Template - can't see the forest through the trees

Otto otto at ottodestruct.com
Fri Apr 2 16:58:13 UTC 2010


On Fri, Apr 2, 2010 at 11:46 AM, Mike Walsh <mpwalsh8 at gmail.com> wrote:
> The theme I am using, which isn't mine, includes tabs across the top based
> on the existance of pages.  The theme supports ordering the tabs and
> preventing pages from becoming tabs but not much else.  What she wanted was
> the posts from one category in particular to be listed when you click on a
> certain tab.

So, what you want isn't really to put a category of posts onto a Page,
but to put a category of posts into that navigation bar/tabs thing
that you have.

Like 90% of the time when I see themes that have lists of pages across
the top, they are using code like this, probably in the header.php:

<ul class="navbar">
<?php wp_list_pages(...); ?>
</ul>

Then the CSS for "navbar" makes it display that stuff in the row.
Well, modifying that to put categories in there too is trivial:

<ul class="navbar">
<?php wp_list_pages(...); ?>
<?php wp_list_categories(...); ?>
</ul>

See? Simple. Now the categories show up in that bar too. If you only
want category 23 to appear in that bar, then that's easy:
wp_list_categories('include=23');

It's always easier to do things the right way, and that means really
defining what you want to do, not how you want to do it.

-Otto


More information about the wp-hackers mailing list