wordpress 数据库中读取文章内容后格式化

<?php
//测试方法: 当前文件路径/?p=1

//加载wp-load
require_once( dirname(dirname(dirname(dirname(__FILE__)))) . '/wp-load.php' );	

wp();

//取得p对应的文章id
$post = get_post($_GET['p']);
//数据库中存储的文章内容
$c = $post->post_content;
//文章格式化
$c = apply_filters( 'the_content', $c );
$c = str_replace( ']]>', ']]>', $c );
//显示文章内容
echo $c;

?>

你可能感兴趣的:(wordpress 数据库中读取文章内容后格式化)