<?php
require_once('blog/wp-config.php');
function get_recent_posts($no_posts = 6, $before = '+ ', $after = '<br>', $show_pass_post = false, $skip_posts = 0) {
global $wpdb, $tableposts;
$request = "SELECT ID, post_title, post_date, post_content FROM $tableposts WHERE post_status = 'publish' ";
if(!$show_pass_post) {
$request .= "AND post_password ='' ";
}
$request .= "ORDER BY post_date DESC LIMIT $skip_posts, $no_posts";
$posts = $wpdb->get_results($request);
$output = '';
foreach ($posts as $post) {
$post_title = stripslashes($post->post_title);
// $post_date = mysql2date('j.m.Y', $post->post_date);
$permalink = get_permalink($post->ID);
$post_content = stripslashes($post->post_content);
$output .= $before . '<a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . $post_title . '">' . $post_title . '</a>'. $after;
$output .= $before . $post_content .$after;
}
echo $output;
}
function mul_excerpt ($excerpt) {
$myexcerpt = substr($excerpt,0,255);
return utf8_trim($myexcerpt) . '... ';
}
get_recent_posts();
?>
分类