Pulling in additional fields in a Mini-Loop?
-
I have WordPress installed in a subfolder ‘articles’ and wish to pull the 3 recent posts along with their teaser and picture into my static home page…but I can’t get that to work.
I’m using this mini-loop:
<?php $how_many=3; //How many posts do you want to show require_once("articles/wp-config.php"); // Change this for your path to wp-config.php file ?> <ol id="whats-new"> <? $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts WHERE <code>post_status</code>= "publish" ORDER BY 'ID' DESC LIMIT ".$how_many); foreach($news as $np){ print ("<li><a href=""); echo get_permalink($np->ID); print ("">$np->post_title</a></li>"); } ?> </ol>…this works in pulling in the post titles, but I want to pull in their their teaser and picture as well….I’ve tried modifying but no luck.
Any suggestions?
Thanks!
-
Any suggestions?
Yup, always read a post labeled “Please read me First” and then head over to teh correct site at http://wordpress.org/support
Regards,
-drmike -
-
- The topic ‘Pulling in additional fields in a Mini-Loop?’ is closed to new replies.