Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

knoppys on "Plugin Code does nto list all my posts."

$
0
0

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 all articles
Browse latest Browse all 8245

Trending Articles