我在wordpress之外创建一个文件,但我想获得wordpress帖子等。我创建了以下这个文件,我想要它做,但它缺少第P
标签。如果我通过wp-admin查看这篇文章,它看起来很好。如果我通过这个功能它能源部鼻涕查看一下找到wordpress missing P标签
ini_set('display_errors','on');
//Global WordPress
global $wpdb;
if(!isset($wpdb))
{
require_once('wp-config.php');
require_once('wp-load.php');
require_once('wp-includes/wp-db.php');
}
$args = array("post_title" => $_GET['name'],"category_name"=>"knowledge-map");
$query = get_posts($args);
$posttitle = $_GET['name'];
$postid = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '" . $posttitle . "'");
$post = $getpost= get_post($postid);
$post_title = sanitize_post_field('post_title', $post->post_title, $post->ID, 'display');
$post_content = sanitize_post_field('post_content', $post->post_content, $post->ID, 'display');
//$postcontent= $getpost->post_content;
//setup_postdata($getpost);
$data = $post->post_content;
//foreach ($getpost as $post) : setup_postdata($post);
//$data = get_the_title() . the_content();
//endforeach;
wp_reset_postdata();
echo $data;
什么用'回声wpautop($ POST_CONTENT)的differene的自动格式;'? – shorif2000 2014-12-04 12:51:56
'wpautop'只有在有新行时才会应用格式。该过滤器也将适用于其他一些案件的格式。看到我上面的编辑。 – rnevius 2014-12-04 12:55:36
'wpautop'包含在'the_content'过滤器中。 – rnevius 2014-12-04 12:57:31