Jump to content

Integrate wordpress blog entry into php page


ringartdesign

Recommended Posts

How can I integrate the most recent wordpress blog entry into php page?

 

Here is my page:

http://halfpricewinenight.com/blog.php

 

Here is the php code I'm using to pull in the blog content. It works well, showing the title and "read post" button, but does not show the blog content (or full body of the blog). Any ideas:

 

<?php

/* Example #1: php to pull and publish wordpress 2 post data

on an external page NO CACHE.

http://www.roccanet.com

*/

 

define('WP_USE_THEMES', false);

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

 

$how_many=100; //How many posts do you want to show

require_once("blog/wp-config.php");

// Change this for your path to wp-config.php file

 

$news=$wpdb->get_results("SELECT ID,post_title,

post_excerpt FROM $wpdb->posts

WHERE post_status= \"publish\"

ORDER BY 'ID' DESC LIMIT ".$how_many);

foreach($news as $np){

 

//NOTE: get other post data by selecting different

//data in the posts table...

 

$permalink=get_permalink($np->ID);

 

$html= "<a href=\"". $permalink .

"\">$np->post_title

 

$np->post_excerpt <a href=\"" . $permalink .

"\">read post

 

\n";

 

//NOTE: you can easily alter the HTML above to suit

 

echo $html;

 

}

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.