1

以下を使用して、子のタイトルとコンテンツを取得しています。各子には、コンテンツ内のコンテンツ エディターにギャラリーとショート コードがありますが、ギャラリーのみを取得し、ショートコードは取得しません。ギャラリーの後にコンテンツに段落を追加しようとしたのですが、それは表示されません。

<?php $pages = get_pages('child_of='.$page->ID.'&sort_order=asc&number=3&sort_column=menu_order&parent='.$page->ID);
foreach($pages as $page) {
    $content = $page->post_content;
    $content = apply_filters('the_content', $content);
?>

    <div class="span4">
       <h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2>
        <?php echo $content ?>
    </div>

$content = apply_filters('the_content', $content);基本的にコンテンツの一部を取り除いていると思います。ショートコードが表示されない理由を教えてください。

4

1 に答える 1

1

これが私がそれを解決した方法です:

<?php
 /*
  Template Name: home
  */
  get_header(); ?>

 <?php $counter = 1 ?>
 <div class="row-fluid"> 
 <?php
$args = array(
 'child_of' => 4,
 'parent' => 0,
 'post_type' => 'page',
 'post_status' => 'publish'
); 
 $childrens =   query_posts('showposts=3&post_parent=4&post_type=page&orderby=menu_order&order=DESC');

  foreach ( $childrens as $children ) :
 query_posts('showposts=3&post_parent='.$children->ID.'&post_type=page&orderby=menu_order&order=DESC');
if ( have_posts ) :
while ( have_posts() ) : the_post();
 ?>
    <div class="span4">
        <h2>
            <?php the_title(); ?>
        </h2>
        <?php the_content(); ?>
    </div>
  <? if ($counter % 3 == 0): ?>
 <div id="content" class="row-fluid"></div>
</div>
<div class="row-fluid">
   <?php endif; ?>
    <?php $counter++; ?>
<?php
endwhile;
 endif;
endforeach;
?>
 </div>

<?php get_footer(); ?>
于 2013-01-28T23:11:27.150 に答える