how do I add a button in each category to display all posts?
I have Create a page that lists posts by category but only shows 5 posts from each category. how do I add a button in each category to display all posts?
Here's my code for a page that lists posts by category:
$categories = get_terms( 'category', 'orderby=nameorder=ASC');
foreach ( $categories as $category ) {
echo 'h2 class="post-title"' . $category-name . '/h2';
echo 'div class="post-list"';
// WP_Query arguments
$args = array(
'cat' = $category-term_id,
'orderby' = 'term_order',
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query-have_posts() ) {
while ( $query-have_posts() ) {
$query-the_post();
?
pa href="?php the_permalink();?"?php the_title(); ?/a/p
?php
} // End while
} // End if
echo '/div';
// Restore original Post Data
wp_reset_postdata();
} // End foreach
Topic archive-template listing Wordpress
Category Web