我已經嘗試了這麼多的PHP組合,以獲得wordpress輸出$ post-> post_content作爲格式化文本(而不是echo $post->post_content
給我的原始格式。這種組合似乎是最有前途的,但它不是?輸出任何東西任何想法爲什麼不是apply_filter('the_content')輸出任何內容?
(這是這一行:<?php $content = apply_filters('the_content', $s->post_content); ?>
)
<?php query_posts('orderby=menu_order&order=asc&posts_per_page=-1&post_type=page&post_parent='.$post->ID); if(have_posts()) { while(have_posts()) { the_post(); ?>
<div class="page">
<?php
global $wpdb;
$subs = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent='$post->ID' AND post_type='page' AND post_status='publish'");
if($subs) {
?>
<div class="navi"></div>
<a class="naviNext"><img src="<?php bloginfo('template_url'); ?>/images/navi-next.png" alt="" /></a>
<div class="scrollable">
<div class="items">
<?php foreach($subs as $s) { ?>
<div class="item">
<h2><?php echo $s->post_title; ?></h2>
<?php $content = apply_filters('the_content', $s->post_content); echo $content; ?>
</div>
<?php } ?>
</div>
</div>
<?php } else { the_content(); } ?>
</div>
<?php } } wp_reset_query(); ?>
不知道爲什麼你沒有得到任何輸出,EXACT相同的代碼在我的WP安裝上工作正常。 – shamittomar 2010-09-10 12:50:22