ringartdesign Posted October 25, 2008 Share Posted October 25, 2008 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; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/130123-integrate-wordpress-blog-entry-into-php-page/ Share on other sites More sharing options...
Flames Posted October 26, 2008 Share Posted October 26, 2008 Note i already have a topic about this and all you have to do is read the database its not that hard, the hard part is getting rid of WP specific features like [caption] Quote Link to comment https://forums.phpfreaks.com/topic/130123-integrate-wordpress-blog-entry-into-php-page/#findComment-675219 Share on other sites More sharing options...
alexweber15 Posted October 30, 2008 Share Posted October 30, 2008 another alternative would be (assuming you have one) read the blog's RSS feed and format it yourself. in fact a guy i know built a whole CMS where the blog was imported and formatted tumblr feeds. Quote Link to comment https://forums.phpfreaks.com/topic/130123-integrate-wordpress-blog-entry-into-php-page/#findComment-678183 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.