Exec-php plugin problems

i’m trying to use the exec-php plugin to show the most recent post at the bottom of the [URL=“http://pokermechanicschool.com/”]homepage here. but for some reason it screwing up the works. i created a [URL=“http://pokermechanicschool.com/test-page/”]test page here to show you what the page looks like without the plugin.

here’s the code i’m using at the bottom of the homepage to make the plugin run:


<h2>Latest Free Poker Mechanic Tip</h2>

<?php
$latestposts = get_posts('numberposts=1&category=1');
foreach($latestposts as $post) :
   setup_postdata($post);
?>
<h2><a href="<?php the_permalink(); ?>"><?php echo $post->post_title; ?></a></h2>
<?php the_content(); ?>
<?php endforeach; ?>

how do i fix it so that it looks right and shows the most recent post at the bottom of the homepage???

It looks like it’s working to me. I see that headline then a post under it on your homepage.

You should not be using exec-php for this, though. You can put this code directly in the home.php template of your site. If you do not already have a home.php file, just copy your index.php and name it home.php. WordPress will use that file when serving your homepage.

thanks Dan. I got it figured out. Apparently the problem was that i didnt use opening and closing P’s around the text. Which is weird because I usually don’t need to do that in the HTML editor but… works now.