One more: Posts from individual categories on a page
-
Dear all
I know this is the millionth time this question is asked, but I still haven’t managed to find a proper answer for me. However – I’m almost there, so if someone (especially moshu) would like to comment, please do.
I am trying to…
..set up two different pages, each to display the two different categories of posts I have. Then on the frontpage I would like to display the most recent post form one category (with a list of the few recent ones) and then a random post from the other.Because..
I have two very different categories and I want things to work as described above. It wouldn’t work with pages. One is ‘news’ and the other is ‘recipies’. And last, but not least, I build the sites navigation menu from the pages. On one page people can click to read the recipies and vice versaYou still with me? Thanks!
So far..
I have managed to get almost there. With the php exec plugin I can execute php code from my page and my code is like this.<?php global $post; $postslist = get_posts('category=4'); foreach ($postslist as $post) : setup_postdata($post); ?> <div> <br /> <h2><a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a> </h2> <?php the_content('More..'); ?> </div> <?php endforeach; ?>
And what does it do? It displays the posts from my category, as it should EXCEPT the content doesn’t come right. You see, it should only display the excerpt and then a link saying ‘more’ but it doesn’t and there lies my problem. Everything else is working fine.
All help appreciated.
- The topic ‘One more: Posts from individual categories on a page’ is closed to new replies.