I am running code that shows child categories, and all posts in the child categories. But if there are more than 5 posts in a category, only the 5 newest are shown.
How can I show all, or at least set a number like 9 posts etc.?
My code:
<?php
$args = array(
'child_of' => 1
);
$categories = get_categories( $args );
foreach ($categories as $category) {
echo '<li><a>'.$category->name.'</a>';
echo '<ul>';
foreach (get_posts('cat='.$category->term_id) as $post) {
setup_postdata( $post );
echo '<li><a href="'.get_permalink($post->ID).'">'.get_the_title().'</a></li>';
}
echo '</ul></li>';
}
?>