To run php code in pages, posts, and text widgets you need to use a plugin like Exec-Php
http://ww.wp.xz.cn/extend/plugins/exec-php/
I am also trying to use the recent posts but by adding them to my home page outside wordpress then when visitors click on ant post it takes them to the wordpress articles. Any help would be appreciated.
@ revilo999: I don’t believe you can call a WordPress function outside of the loop. Try utilizing a feed reader to accomplish this.
@uteman23: Try using this code to call the top most recent headlines
<?php
$recent_posts = new WP_Query();
$recent_posts->query('showposts=5');
?>
<?php while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
<?php endwhile; ?>
This should pull the title for you. You can also pull the excerpt if you’d like by using adding this code:
<?php the_excerpt(); ?>
Style however you’d like.