Hi everyone. I know there are similar posts about this but none of them seem to work for my intent and purpose so here it gos. I need the newest post in 2 categories to show up on my static home page. So far I have attempted the following to no avail.
1: various variations of get_posts (as researched on the WP codex and Forums)
2: making a page template and using "custom field" to add the category value. (as researched in page templates)
in most cases I can get one category showing but never both at once.
notes: -using Theme: twenty ten
-The actual loop is showing on a separate Blog page.
-my php skills are way under par and I'm fairly new at WP
Thanks,
-a
I know you said your PHP skills are under par but have you looked at the following page? http://codex.wordpress.org/The_Loop
About 40% of the way down the page is the section about using multiple loops on the same page. It should give you a good starting point but if you need some more help let me know.
Yeah, you should easily be able to make a page templat and give it 2 loops. Using either query_posts or get_posts.
Each loop calls a categopry and limits posts to 1.
Whats the difference between: query_posts and get_posts??
query_posts() can be used to display different posts than those that would normally show up at a specific URL.
http://codex.wordpress.org/Function_Reference/query_posts
get_posts() retrieves a list of latest posts or posts matching criteria.
http://codex.wordpress.org/Function_Reference/get_posts
i've resolved this trouble using this code:
query_posts( 'posts_per_page=1&cat=CATEGORYID' );
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title();?></h2>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>"><strong>Read more »</strong></a>
<?php endwhile; endif; ?>