Showing excerpts from one category
-
Hello,
I’m integrating my new design with wordpress as we speak and am having a problem I have been trying to push through this afternoon that I haven’t been able to conquer.
In my sidebar I have three loops beside my main loop on my index page. Two of the loops are just to print the links/titles to topics from two seperate categories. Works fine.
The third loop I wanted to show not the permalink or title, but just the content from that category (which happens to be an image).
To explain this part more clearly – I want only one categories posts to show. These will be a series of 6 of the most recent posts shows in the top right of my sidebar. These posts are only images. This was the code I was using and works for my other two loops (which display the permalinks and titles to my most recent posts in one category):
<?php $posts = get_posts('numberposts=5&category=4'); foreach($posts as $post) : ?> - <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br /> <?php endforeach; ?>
But when I take out:
- <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
And replace it with:
<?php the_content(); ?>
The post content that shows is NOT from the category, it’s from the previous post.
Can someone help me out here?
To sum it up one last time – I just was the 6 most recent posts from category 4 to show, and not the link or title, just the cotent of the post.
- The topic ‘Showing excerpts from one category’ is closed to new replies.