category

category

Wordpress Category Post List

A friend of mine asked me to write a Wordpress function the other day that printed out a list of categories and any posts in those categories, along with any meta data that might be in the post.

All the function does is to get a list of categories and then for each category get a list of the posts associated with that category. Not much really, but useful in some circumstances.

Create A Page Of Posts In Wordpress

A common practice when setting up a Wordpress blog might be to create a page and display posts in a certain category on that page. This causes some pages to act very much like category pages.

The first step in creating a page of posts is to create a page template that can be used by the pages. Create a file in your template directory called pageofposts.php and put the following comment in it.

Display Certain Categories Within Wordpress

If you want to display a Wordpress front page in a new or interesting way by splitting the categories into sections, or by not displaying certain categories at all then you can use the query_posts() function. This function comes as part of Wordpress and allows you to override the queries that are being executed behind the scenes. This basically controls what posts are seen by "the loop". In order for the function to work it must be called before "the loop", look out for this line (or similar):