Created
February 11, 2010 21:23
-
-
Save artlung/301974 to your computer and use it in GitHub Desktop.
Most Recent Post with Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// include trailing slash | |
$path_to_wordpress_folder = '../wordpress/'; | |
/* | |
Does someone have a WP plug-in or snippet so that the most recent post on WP | |
can be seen on a different php page? In this case the homepage. | |
I'd actually just like a snippet to be seen, not the whole post. | |
*/ | |
// Learn to use http://codex.wordpress.org/Template_Tags/get_posts | |
require_once($path_to_wordpress_folder . 'wp-config.php'); | |
$postslist = get_posts('numberposts=1'); | |
foreach ($postslist as $post) : | |
setup_postdata($post); | |
?> | |
<div> | |
<?php the_date(); ?> | |
<br /> | |
<?php the_title(); ?> | |
<br /> | |
<?php the_excerpt(); ?> | |
</div> | |
<?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment