Title: Plugin Code does nto list all my posts.
Last modified: August 21, 2016

---

# Plugin Code does nto list all my posts.

 *  [knoppys](https://wordpress.org/support/users/knoppys/)
 * (@knoppys)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/plugin-code-does-nto-list-all-my-posts/)
 * Good morning
 * I created my own plugin. Just something for listing all sub categories including
   posts and permalinks of a given parent category.
 * Problem is it only seems to be outputting 5 posts per categpry.
 * I dont think theres anything in the code that limits the output to 5 posts, can
   someone just put my mind at rest for me and tell me im right.
 *     ```
       public function widget( $args, $instance ) {
       		if( $c = get_category(@$instance['category_id']) ){
   
       			foreach(get_categories(array(
       				"child_of"	=> $c->cat_ID
   
       			)) as $childCat){
   
       				echo '<div class="container">';
       				echo('<h2 class="widgettitle">'.$childCat->name.'</h2>');
       				echo '<ul>';
   
       				foreach( get_posts('cat='.$childCat->term_id) as $p) {
       					echo('
       						<li>
       							<a href="'.get_permalink($p->ID).'">'.$p->post_title.'</a>
       						</li>
       					');
       				}
       				echo '</ul>';
       				echo "</div>";
   
       			}
       		}
   
       	}
       ```
   

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/plugin-code-does-nto-list-all-my-posts/#post-4643390)
 * `get_posts()` defaults to 5 posts per page unless you supply a ‘posts_per_page’
   argument stating otherwise.

Viewing 1 replies (of 1 total)

The topic ‘Plugin Code does nto list all my posts.’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [plugin-code](https://wordpress.org/support/topic-tag/plugin-code/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/plugin-code-does-nto-list-all-my-posts/#post-4643390)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
