• Resolved bencharity

    (@bencharity)


    I am creating a page that has 5 main divs. Each div will contain a list of every post that pertains to that section.

    So the ‘Restaurants’ div will contain a link to every post about a restaurant… etc.

    My question is, what is the best way to do this? I was thinking that I would use blog categories to separate the posts, and I would like the post snippets to display the title, maybe an image (not necessary), and a snip of the text (20-30 words). This would be in a two column layout, about 350px wide each.

    What is the best way to do this? Is there a tag to call a category with a snip of the post? This will be hard coded in the template rather than in the post if it matters.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter bencharity

    (@bencharity)

    For anyone else looking, this displays the posts in list form:

    <ul>
    <?php
     $postslist = get_posts('numberposts=5&order=ASC&orderby=date&category=7, 17, 18, 19, 20, 21, 22, 23, 24');
     foreach ($postslist as $post) :
     setup_postdata($post);
     ?> 
    
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    
     <?php endforeach; ?>
    </ul>

    This displays 2 posts from category 7 with the title and an excerpt:

    <?php
    query_posts('showposts=2&cat=7');
    while(have_posts()) : the_post();
    ?>
    
    	<div>
    		<h5><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h5>
    
    		<?php the_excerpt(); ?>
    
    	</div>
    
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘The best way to include lists of posts within a page?’ is closed to new replies.