Please search the codex, normally is is supported within themes by a simple wordpress function call. When I remember correctly it is called wp_list_pages.
that will work if i want to list posts in all the categories, but there is no parameter to select 1 category and list each post under that.
ok, i though that using the wp_list_categories with an include tag would do it for me, but it wont list each post under the category, just the category name.
well but it should be possible to use get_posts limited to one category:
http://codex.wordpress.org/Template_Tags/get_posts#Posts_list_with_offset
get_posts will show the posts, not list them. I think what you want is wp_list_categories – see this Codex doc for more info on how to use it:
http://codex.wordpress.org/Template_Tags/wp_list_categories
I use it in my sidebar and it works, however, with 2.5 it now inserts the word “category” before the actual category name, which I don’t want. I’m searching now for a fix for that (my category list appears like this:
sitename/category/products/widgets/
what I want is:
sitename/products/widgets/
If you find a fix for this please post it!
get_posts will show the posts, not list them.
Well, that is not true. It will actually query the posts. You can do whatever you want with that query then, for example creating a list of posts:
<ul>
<?php
global $post;
$myposts = get_posts('numberposts=5&offset=1&category=1');
foreach($myposts as $post) :
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
This is the code example from the codex I linked in my post above. As you can see, it is creating a list of posts. In this Example the first 5 posts of category with the ID 1 are listed.
Your suggestion of wp_list_categories is misleading. It is for displaying a list of categories, not of posts.
You’re right – I am using it to display Child categories of specific Categories, thusly:
Parent Category
Child Category 1
Child Category 2
and so forth……….my bad. I think I misread the original question.
wearemoviegeeksdotcom, did my suggestion helped you?
I don’t know whether it helped him but it certainly helped me. Thank you!
Do you (or anyone else) happen to know if it’s possible to dynamically highlight the given title of the post you’re on in that sidebar list?