Using the_content after get_posts on a Page
-
I’m sure this is a rather frequently asked question, and probably extremely simple to solve, but I can’t seem to find the answer even after scouring the forum and even trying Google.
Essentially, I have a site with 5 main Pages, and would like each Page to show a list of Posts from a specific category on the right-hand side.
Using the following code works fine, except that I want the Page’s content to appear after the list of Posts – but moving the_content to the end of the code then returns content from the Posts, and not the Page they’re on.
<? the_content('Read more...'); ?> <div id="IOB_theInkWellBlog"> <?php switch ($post->ID) { case '3': $postslist = get_posts('category=5&numberposts=5&order=ASC&orderby=post_date'); break; case '4': $postslist = get_posts('category=6&numberposts=5&order=ASC&orderby=post_date'); break; case '5': $postslist = get_posts('category=7&numberposts=5&order=ASC&orderby=post_date'); break; case '6': $postslist = get_posts('category=8&numberposts=5&order=ASC&orderby=post_date'); break; case '7': $postslist = get_posts('category=9&numberposts=5&order=ASC&orderby=post_date'); break; default: break;} if ( $postslist ) { foreach ($postslist as $post) : setup_postdata($post); echo "";?> <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3> <?php the_excerpt(); endforeach; } ?> </div>
How can I fix my code so that the_content will display content from the current Page rather than from the list of Posts?
All comments, thoughts, criticism and help are GREATLY appreciated – Thanks in advance to all who reply!
- The topic ‘Using the_content after get_posts on a Page’ is closed to new replies.