How do you create a custom template to display a category with an image and related posts below?

I am trying to create a custom template that can give the following effect…

Should I do this with custom post types? If so, do I have create two, or can I manage this with one custom post type?

Related posts

Leave a Reply

1 comment

  1. I am not sure I understand exactly the problem, but If I do – there is absolutely no need for a custom post type.

    all you have to do is use multiple loops and basically divide the query into sub-loops for each category .

    <div id="cat-1">
         <?php query_posts('cat=1&posts_per_page=5');// put relevant category and number of posts
             if (have_posts()) : while (have_posts()) : the_post();
             // Do whatever ...
         endwhile; endif; reset_query();?>
    
    </div>
    
    <div id="cat-2">
         <?php query_posts('cat=2&posts_per_page=1');// put relevant category and number of posts
              if (have_posts()) : while (have_posts()) : the_post();
              // Do whatever ..
         endwhile; endif; reset_query(); ?>
    </div>
    
    <div id="cat-3">
         <?php query_posts('cat=3&posts_per_page=-1');// put relevant category and number of posts
              if (have_posts()) : while (have_posts()) : the_post();
              // Do whatever ..
         endwhile; endif; reset_query();?>
    </div>..etc.. etc..
    

    Note that you can do the same using Loops with query_posts() , Loops with WP_Query() or Loops with get_posts().

    regarding the image – I am not sure what Image you want – but if you refer to a category image (special image assigned to categories) you will need to use some plugin like these ..