I've spent all night going through the Wordpress DOCS and support forums trying to get this to work...
I've set a static page as the "Front Page Display" to act as my home page. I want to add a LOOP to show the most recent posts within the home page content, but can't add PHP without a PLUGIN. I've tried using Exec-PHP and RunPHP to do this.
When I run some PHP test code through, everything seems to work fine. But when I add the PHP code for adding a loop-- I get an error everytime (referencing the PLUGIN file)! This is the code I added for a mini-loop:
<?php
$how_many=5; //How many posts do you want to show
require_once("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){
printf ("<li><a href=\"index.php?p=%s\">%s</a></li>", $np->ID,$np->post_title);
}?>
</ol>
Am I missing something here? Obviously, the PLUGINS are working because small snippets of PHP work fine. Just can't get a loop to work!
Any suggestions???