Page is a not externally linkable
- Code, Content, and Presentation
-- WordPress
---- How to link to recent posts from main website outside wp


tlainevool - 2:47 am on Oct 18, 2012 (gmt 0)


Here is code I wrote a long long time ago to do just that. Warning, it isn't great code, but it still seems to work just fine:

require('wp-blog-header.php');

function getHeadlines() {
get_currentuserinfo();

$i = 0; if ( have_posts() ) : while ( have_posts() && $i < 4 ) : the_post();
echo "<a href='";
the_permalink();
echo "'>";
the_title();
echo "</a> - ";
$excerpt = get_the_excerpt();
$pos = strpos($excerpt,".");
if( $pos !== false ) {
$excerpt = substr($excerpt,0,$pos + 1);
}
if (strlen($excerpt) > 80) {
$excerpt = substr($excerpt,0,80);
}
echo $excerpt;
echo "<a href='";
the_permalink();
echo "'>[more]</a><br/><br/>";

$i++; endwhile; endif;
}


Thread source:: http://www.webmasterworld.com/wordpress/4508113.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com