How can I pull my Wordpress blog into a Dreamweaver site?
I'm trying to make a website using Dreamweaver. I'd like to have a page on my website that has all th开发者_开发知识库e blog entries from my Wordpress site, but I'm not sure how to pull the data into my site and display it.
Will this have to be done manually by hand for each entry or is there a way that I can automate this?
You can automate it. Is the blog on the same domain? If so, this should do it:
<?php
// Include Wordpress
define('WP_USE_THEMES', false);
require('PATH/TO/wp-blog-header.php');
query_posts('showposts=NUMBEROFPOSTS');
?>
Hope this helps.
jchapa was faster; I'll post anyway because this approach is slightly different than his and may suit better.
I use the snippet below to connect to a Wordpress on the same server:
include ("/your/blog/path/wp-blog-header.php");
$myposts = get_posts('numberposts=$number&offset=0&category=0');
echo "<ul class='Bloglinks'>";
foreach($myposts as $post)
{
echo '<li><a href="';
the_permalink();
echo '">';
the_date();
echo " ";
the_title();
echo '</a></li>';
}
echo "<ul>";
IThis snippet load the whole wordpress engine into memory, and wordpress is BIG. If you get memory_limit problems, make this a include file that you include via HTTP in your dreamweaver file.
精彩评论