[wp-hackers] Embed WP Post in Page outside WP. Tried,
but getting error.
MattPat at mattpat.net
Thu Aug 16 20:55:14 GMT 2007
Logically speaking, the file should be included just fine-- it's
included from wp-settings.php, which is included from wp-config.php
(which is included by wp-blog-header.php). Make sure the requirement
is going to the proper file, perhaps? Other than that, I'm not sure.
Just my two cents. :P
On Aug 16, 2007, at 4:43 PM, One Eyed View wrote:
> Hi everyone, this is my first post here (just found this list). I
> have a
> question about embedding a WP post in my .php page outside of my WP
> installation. I'm trying to include just the latest post on the
> main page of
> my site. Seems relatively easy right?
> I found this thread on the WP forums
> http://wordpress.org/support/topic/83086. Here what it says...
> Any page that is outside the WP installation can still have WP
> stuff on it.
> Just add this to the top of the page:
> <?php require('pathtoyourwordpressinstall/wp-blog-header.php'); ?>
> So, if you put that little bit of code at the top of the page, this
> work to display the most recent post:
> $posts = get_posts('numberposts=1');
> foreach($posts as $post) :
> "<?php the_permalink(); ? " id="post-<?php the_ID(); ?>"><?php
> <?php the_content(); ?>
> <?php endforeach; ?>
> So, I tried this and I am getting an error: Fatal error: Call to
> function: get_posts() in
> /home/content/a/a/a/myusername/html/newsite/index.php on line 78
> The file I am including, wp-blog-header.php seems to includes this
> require_once( dirname(__FILE__) . '/wp-includes/functions.php');
> I've looked inside the functions.php page and searched for get_posts
> (), but
> did not see a reference to it.
> My main page is here: http://mysite.com/newsite/index.php
> My blog is here: http://mysite.com/blog/
> I am using the latest version of WP (Version 2.2.2)
> Would anyone here be able to clue me in as to what's going wrong
> here, or
> maybe point me in the right direction of where to look? I would be
> View this message in context: http://www.nabble.com/Embed-WP-Post-
> Sent from the Wordpress Hackers mailing list archive at Nabble.com.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers