2016-08-08 10 views

答えて

2

次のコードを試してください。 カテゴリIDとページごとの投稿を必要に応じて追加できます。

<?php 
$catquery = new WP_Query('cat=3&posts_per_page=10'); 
while($catquery->have_posts()) : $catquery->the_post(); 
?> 
<ul> 
<li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> 

<ul><li><?php the_content(); ?></li> 
</ul> 
</li> 
</ul> 
<?php endwhile; ?> 
+0

感謝。コードは正常に動作しています。 – Joshi

+0

ようこそ@ジョシ。 –

0

別の方法:助けを

// The Query 
query_posts(array(
     'category_name' => 'my-category-slug', 
     'posts_per_page' => -1 
)); 

// The Loop 
while (have_posts()) : the_post(); 
    echo '<li>'; 
     the_title(); 
    echo '</li>'; 
endwhile; 

// Reset Query 
wp_reset_query(); 
関連する問題