mrtoner
Member
Posted 3 years ago #
Before I get in over my head, could someone point me in the right direction? When viewing a single post in category A, I want another post from category B inserted at the end. The category B post will be the most recent of all the category B posts and will be only an excerpt of that post, with a "read more" link to the full post.
TIA!
So do a get_posts loop in your single.php after the loop that displays the single post.
One example to consider:
http://www.daobydesign.com/blog/2007/07/modifying-wordpress-front-page/
mrtoner
Member
Posted 3 years ago #
Thanks, Michael, it wasn't so hard after all:
<?php
if (in_category(array('resources','news'))) :
$postslist = get_posts('category_name=recommends&numberposts=1&order=DESC&orderby=date');
foreach ($postslist as $post) :
setup_postdata($post);
?>
<div>
<br /><br />
<h4>Not free, but worth it...</h4>
<?php the_excerpt(); ?> <a href="<?php the_permalink(); ?>">Read more ยป</a>
</div>
<?php endforeach; ?>
<?php endif; ?>