The idea here is the following (I've now uploaded a picture to make it clearer what I need):

  1. Create a new page that contains a nicely formatted CSS table.
  2. Each row would refer to a specific post from a specific category.
  3. Each column would refer to specific information about that post (linked title, post date, post author, etc.)

Do I have to learn how to fetch that specific information from the database in order to populate this table? Or is there any easier way to "tell" WordPress what I need to be (dynamically) allocated to each cell?

Thanks! I'm really in the dark as to how to start this. Would appreciate any help I can get.

basic image example of what I need

  • Toscano, what you are looking to do is create a wordpress loop. A quick google search on creating one or using wp_query will get you started in the right direction. Your question is fairly vague so it's difficult to give more assistance.
    – rudtek
    Feb 24, 2017 at 17:25
  • Thanks, @rudtek. I've now attached a picture that might make it clearer. Basically, I just a table that shows a list of posts from different categories, and if you want to check out a specific post, just click the link and there you'd go. No images on that page, just a quick and easy to browse text table where you can have a quick glance of everything (and then click and go there if you want to). Kind of like an index, almost.
    – Toscano
    Feb 24, 2017 at 18:12

3 Answers 3


1: You can use Page template and custom WP_Query to show posts from a specific category into a page.

2: you can also achive same thing with shortcode where you will have to create a shortcode containing posts from specific category and paste that shortcode into your page.


added sample code for custom page template and wp_query

 * Template Name: Custom post page
get_header(); ?>

<div class="main-content" id="main">

$args = array(
  'post_type' => 'post',
  'posts_per_page'  => 10,
  'category_name' => 'your-category-slug', // replace it with your category slug
$query = new WP_Query( $args );
if ( $query->have_posts() ) : ?>
<table class="table post-table">
      <td><strong>Post Date</strong></td>
<?php  while( $query->have_posts() ) : $query->the_post();

      <td><?php the_title(); ?></td>
      <td><?php the_author(); ?></td>
      <td><?php the_date( 'F j Y'); ?></td>

<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
<?php get_footer(); ?>

create a new php file inside your theme folder and place the above code into it. and them create a new page from WP dashboard and on the right sidebar select your Custom post page template.

  • Thanks, @Abdul Rehman ! Guess this is exactly what I needed. Thanks again.
    – Toscano
    Feb 24, 2017 at 20:01
    <th>Category Name</th>
    <th>Post Title</th>
    <th>Published Date</th>

<?php $temp = $wp_query; $wp_query= null;
    $wp_query = new WP_Query(); $wp_query->query('showposts=10' . '&paged='.$paged);?>

    <?php if ( $wp_query->have_posts() ) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <td><?php the_category( ', ', $parents, $post_id ); ?></td>
    <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
    <td><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"> <?php the_author(); ?> </a></td>
    <td><?php the_date(); ?></td>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>

You Can try this. Hope this will help you.

if ( have_posts() ) {
    while ( have_posts() ) {
        // Post Content here
    } // end while
} // end if

inside of the while loop you will put in your html for your table and inside of the table you will need to call the_category(); the_title(); the_author(); get_the_date('j/n/y');

NOTE: Make sure your header row to your table is not inside the while loop otherwise you will spit out the header row as well.

  • What the above will do is loop through all your posts and spit them all out displaying only the data you are asking for. (which is category, title, author, and date. So you only need to create one row (not including your header row) and they will loop.
    – Parzi
    Feb 24, 2017 at 18:23
  • You could thumbs up my answer then. :) hope it helped.
    – Parzi
    Feb 25, 2017 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.