Alrighty, another thing that comes up often for Wordpress, that I always forget how to do, is very similar to what I posted previously about excluding certain categories. This is listing a certain amount of titles, we’ll say 5, on the front page of the site. Below is the code for doing that.
< ?php query_posts('cat=9&showposts=5');?>
< ?php if (have_posts()) : ?>
< ?php while (have_posts()) : the_post(); ?>
< div id="post-< ?php the_ID(); ?>“>
< a href="< ?php the_permalink(); ?>“>< ?php the_title(); ?>
< ?php endwhile; ?>
< ?php endif; ?>
*if you’re going to copy and paste this code, make sure to take out all extra spaces.
Most of the work of this code takes place in line #1, where you specify the category you want to show and the amount of posts. The second most important piece of this code is line #5, the permalink and title code. This is how you’ll link to the actual posts that are listed. There’s more you can do with this I’m sure but this is the snippet of code I use most often.
BwRNpq gfb7n0ghn60s9d7f34n30bnit5
and what about if i want to show the image from the post ?
plase save my life
thank you!
Thanks David. I’ve been so busy lately that I just haven’t felt like being online.
Likewise, I haven’t needed to use this code, but it certainly sounds useful!
Nice to know you’re still around, Jen.
No problem lady!