Several blog rolls on a single WordPress site using categories

Here’s a simple code example of how you can have separate blog roll areas on your WordPress website which show different types of blog content. Just add this query to your template file:

<?php
  $query = new WP_Query(array('category_name' => 'reviews'));
  
  if ($query->have_posts()): while ($query->have_posts()): $query->the_post();
?>

<div class="review">
  <h1><?php the_title(); ?></h1>
  <?php the_content(); ?>
</div>

<?php
  endwhile;
  else:
    echo 'No posts';
  endif;
?>

If you don’t want to hard code the blog roll in a template file, another option would be to add the category rolls to your menu in the menu editor. That way clicking on such a menu link will take you to the blog post list (archive) of the posts that belong to that archive.

Leave a Reply

Your email address will not be published. Required fields are marked *