wordpress - Why this code display only 3 entries? WP -


i created template category-beers.php should display posts single category. posts should display in table. works good, code display 3 recent posts. should edit, display posts category?

<table class="drinked-beers"> <tr> <th>beer</th> <th>consumer</th> <th>i drinked beer on </th> <th>style</th> <th>note</th>  </tr> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <tr> <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td> <td><?php the_author(); ?></td> <td><?php the_date(''); ?> </td> <td><?php the_tags(''); ?> </td> <td><?php echo get_post_meta($post->id, 'my-note', true); ?></td> </tr> <?php endwhile; endif; ?> </table> 

i haven't tested this, think achieve you're looking for.

<?php $categories = get_the_category(); $category_id = $categories[0]->cat_id; $args = array( 'category' => $category_id, 'post_type' =>  'post' , 'numberposts'=>-1);  $posts = get_posts( $args );     foreach ($posts $post){     setup_postdata($post);?>      <tr>         <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>         <td><?php the_author(); ?></td>         <td><?php the_date(''); ?> </td>         <td><?php the_tags(''); ?> </td>         <td><?php echo get_post_meta($post->id, 'my-note', true); ?></td>     </tr> <?php } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -