views:

42

answers:

2

Hi, I have self-hosted word-press Blog, and I am making a static home-page for my website based on jQuery. So, I wanted to display some content from my blog , in my home page ( in widgets ) , as a news section

For example , I may fetch

  • latest 5 posts titles & contents
  • OR a specific page content ( via passing page id )
  • OR a specific post ( via passing post id )

So does Wordpress include any PHP file , that shows the posts contents as plain text, or HTML ??

I thought about fetching the Blog's RSS , then show it on the page,
but the RSS doesn't provide the full content of the post.

Thanks in advance

A: 

Take a look at Yahoo! Pipes.

wrumsby
+2  A: 

If it's hosted on the same server, you could integrate wordpress into your app by including wp-blog-header.php, and then call get_posts(), using setup_postdata().

For example:

 <ul>
 <?php
 global $post;
 $tmp_post = $post;
 $myposts = get_posts('numberposts=5&offset=1&category=1');
 foreach($myposts as $post) :
   setup_postdata($post);
 ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
 <?php endforeach; ?>
 <?php $post = $tmp_post; ?>
 </ul> 
blockhead
yes, it is hosted on the same server , but not the same sub-domain. the blog is hosted at blog.mydomain.com and the homepage will be at www.mydomain.com .Can I still include WordPress's header ??if yes, what about if I wanted to get a static-page content ?
Radian
I just got an idea , I can add a php file to my Wordpress which takes the post/page id as a GET parameter , and just echo the contentlater I call this php page from my Homepage via AJAX
Radian
As long as the two sites are running on the same physical machine, they could have different subdomains, different domains, or even different IP addresses sometimes. The important fact is that they're on the same machine. If that's the case, you can just include the wordpress header, just like any PHP file on the same machine.
blockhead
There's definitely no need for the overhead of XML-RPC if you're on the same machine.
blockhead
And definitely not the *double* overhead of Yahoo! Pipes.
blockhead