• I use hard coding on my blog’s sidebar, since I use a lot of conditional coding and want full control of it. There are three categories on my blog (photos, videos, and words) that don’t display in the main loop, but rather on their own category pages.

    I want to, in the sidebar, have a “Recent posts” type of section that displays the latest 5 posts from all three categories combined.

    For example:

    Recent Stuff
    ————————–
    + Video: Title here
    + Photo: Title here
    + Video: Title here
    + Words: Title here
    + Words: Title here

    I know there’s some way to use wp_query or query_posts to achieve this, pulling the most recent posts from all three categories without having to exclude all the other categories used on my blog from a straight “recent posts” dump.

    Any help would be fantastic.

    Also, any way to give each category a separate class… eg:
    <a href="#" class="video"></a>
    I just need to know what I would put in place of class to have the category slug pulled from the post and put in there… just wanting to have a different icon for each category.

    Thanks in advance!

The topic ‘Recent posts from 3 categories in sidebar’ is closed to new replies.