Shelley Keith
Member
Posted 4 years ago #
I'm trying to put a list of posts from the "Announcements" category (title/link only) on the sidebar of my blog. I've tried wp_get_posts, wp_get_archives, etc. I can generate a list of ALL recent posts, or a list of months that contain posts, or a list of categories that contain posts, but I can't get it to just show posts from announcements. I'm not a WP noob...but I'm totally stumped. This seems like an easy thing and I'm probably just missing it...help!
EnderatEros
Member
Posted 4 years ago #
You'll have to make a Loop that shows just the title/link.
You'll have to enter the category ID and the # of posts you want. (just replace the #'s)
http://pastebin.ca/904650
Use the "code" quicktag around your code - that's why you have it there...
EnderatEros
Member
Posted 4 years ago #
moshu: thanks, I tried that, but it kept getting messed up. I used a pastebin instead.
Like this:
<ul>
<?php query_posts('category_id=#&showposts=#');?>
<?php $posts = get_posts('category=#&numberposts=#&offset=0');
foreach ($posts as $post) : start_wp(); ?>
<li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?></ul>
EnderatEros
Member
Posted 4 years ago #
That is bizarre, the 2nd time around I seriously did try it like that.
Shelley Keith
Member
Posted 4 years ago #
Thank you so much, that did it!