特定のカテゴリの子供の猫のすべての投稿を取得する基本的なスクリプトがあり、結果の投稿をシャッフルして表示しています。そのため、cat 4 の新しい子カテゴリを追加しましたが、現在のスクリプトを使用して、そのサブ cat の新しい投稿が表示されません。子を変更して、具体的に cat_ID でこれらを取得しようとしたところ、表示されました。何度もリロードして読み込まれるかどうかを確認するだけでなく、他のサブ猫の投稿と比較して投稿の数が少ないため、30 に含まれていないことを確認します。
私のコードは次のとおりです
<?php
$posts = array();
$categories = get_categories( 'child_of=4' );
foreach($categories as $category) {
$args=array(
'showposts' => 30,
'category__in' => array($category->term_id)
);
$posts = $posts + get_posts($args);
} // Close your foreach here
shuffle($posts);
if ($posts) {
foreach($posts as $post) {
setup_postdata($post); ?>
<div <?php post_class('boxy');?>><div class="soc-label" ></div>
<?php
if ( has_post_thumbnail()) {
$full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
echo '<a href="' . $full_image_url[0] . '" rel="lightbox" title="' . the_title_attribute('echo=0') . '" >';
the_post_thumbnail('thumbnail');
echo '</a>';
}
?>
<?php the_content(''); ?>
</div>
<?php }
}
?>
私が欠けているものについての考え?