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;

 

}

?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.