PHP code for pulling in posts on Pages
Hello, I need some help. I am trying to pull in several posts from multiple categories into my custom WP pages. I know how to get the posts and pub date to appear with the following PHP:
$myposts = get_posts(‘numberposts=7&offset=1&category=5’);
foreach($myposts as $post) :
” ><?php the_title(); ?>
<?php the_time(get_option(‘date_format’)); ?>, <?php the_time(‘g:i a’); ?></span>
<?php endforeach; ?>
But what I can’t figure out how to do is to pull in 1, 2, 3, posts etc. from a category onto a Page and also pull in a short description (like it appears on the category page itself), and whatever photo or media is included with the post, i.e. a thumbnail, logo, or photo. I’m not a novice at PHP. But it appears that I am when it comes to figuring this one out. I don’t want a thumbnail. I am basically trying to create a “top story” for each section of my site that pulls in this info from specific categories.
Anyone have any ideas that could help? I’m stumped and I’m up against a hard deadline. Thank you in advance for your help.
- The topic ‘PHP code for pulling in posts on Pages’ is closed to new replies.