• Resolved hzp

    (@hzp)


    howdy folks.

    so, i’ve put up this site http://www.padresmexican.com

    in the sidebar, I would like it to have a list of posts from just the press category, and just the titles, which would of course, be links back to those posts.

    It would, in my mind (a lovely place, by the way) look like this: http://www.padresmexican.com/pdfs/home.pdf
    (wherein each line would have been a title of a post in the press section)

    you’d think this would be simple, but its confoundingly NOT. takers?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter hzp

    (@hzp)

    to be fair, I found both of those solutions by searching (i do always check. i hate playing the noob), but I wasn’t sure either of these really solved the issue.

    I mean, i guess I understand that I could simply do a category list and exclude all other categories, but then, how do I get it to just list the post titles… postbypost? I didn’t see them working together anywhere in the codex. and don’t forget, this isn’t a page, but the sidebar.

    For instance, with the coffee2code, when i looked, although it mentions in the top that it can limit by category, i don’t see it in the code itself. am i just missing it?

    If you were to use the plugin, for instance, how would you write it to limit it to say, category 5, listing the 10 most recent post titles, by date?

    Thanks for your patience 🙂

    Well, based on the details provided at the link I pointed to, I imagine this would do it:

    <?php c2c_get_recent_posts(10, '<li><a href="%post_url%">%post_title%</a></li>', '5'); ?>

    Ordering by date etc. are the defaults, so no need to play with them.

    By the way, using get_posts() for this is not too difficult, either:

    <?php
    $postlist = get_posts('category=5&numberposts=10');
    foreach ($postlist as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    Thread Starter hzp

    (@hzp)

    🙂 thank you. that really helps a lot.

    i’m going to give both a try tomorrow.

    does the above code work with multiple category exclusions ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘sidebar-list posts from one category only’ is closed to new replies.