This shows the title and permalink of the latest post in mycategory. Change showposts to -1 to show all posts, or another number to show that number of posts. This loop can be used mutliple times in page; the key is the new query:
<?php $my_query = new WP_Query('category_name=mycategory&showposts=1'); ?><?php while ($my_query->have_posts()) : $my_query->the_post(); ?><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><?php endwhile; ?>
It doesn’t show any posts at all.
Are you using that loop on a page or page template in a post?
In index.php? Post your index.php at WordPress Pastebin and then put the link here.
See pastebin; it’s better to modify the existing WP loop than run a new query.
But if I want to add a new one?
Use the pastebin code for your first query. Then put the new query (that’s in my first post above) after <?php }; ?> and before the <?php endwhile; ?>
The new query doesn’t show anything at all…
Hmm…. Paste the code of the whole index.php again….
It’s the exact same, just with the new query added after <?php }; ?> and before the <?php endwhile; ?>.
I’ll test it on my local install….
Simplfied and tested: http://wordpress.pastebin.com/m4fea32ed
Change your cat numbers to what you want, as well as showposts. Duplicate lines 15 to 24 for another query and put it above the <?php else: ?>.