• I want to make my home page like this: http://www.rockleybulletin.com/

    Is it possible to create a table with several columns and then pull in posts from different categories into those different table cells?

    For example, I’d like one table cells to be Jobs and I’d like that cell to pull in the last 2 job category posts. Another cell would be events and it would pull in the last 2 events posted. And so on. Is this possible?

    my site is http://stc-suncoast.org.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Yeah, it would be possible, you’ll need to learn about The Loop and query_posts over on the codex.

    Thread Starter TomJohnson

    (@tomjohnson)

    My loop is <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?> but the instruction on the codex has it listed differently.

    Thread Starter TomJohnson

    (@tomjohnson)

    I see that the theme I’m using (Connections) uses WordPress’s 1.2 loop. It seems like the instructions for creating multiple loops all apply to 1.5 loops. Can you point me to a specific page that explains how to do multiple loops with 1.2? Thanks,

    Tom

    My loop is <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>

    Nope, that’s just the first line of the Loop – even in WP 1.2 it is much longer!
    Not too much documentation on WP 1.2. Why not just replace the old Loop with the 1.5 version – and you will find plenty of examples in the Codex how to use multiple Loops.

    Thread Starter TomJohnson

    (@tomjohnson)

    I would like to swap the old loop for the new, but I just tried it and it didn’t work. Let me know if I didn’t do something right.

    On my home.php page, I highlighted my loop:

    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    <div class=”post”>
    <?php require(‘post.php’); ?>
    <?php comments_template(); // Get wp-comments.php template ?>
    </div>
    <?php endforeach; else: ?>
    <?php _e(‘Sorry, no posts matched your criteria.’); ?>
    <?php endif; ?>

    Then I replaced it with the 1.5 loop:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <?php endwhile; else: ?>
    <?php _e(‘Sorry, no posts matched your criteria.’); ?>
    <?php endif; ?>

    When I viewed the site with the new loop, no posts appeared. What am I forgetting to do here?

    You mean you have just this:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>

    without any template tags in between? Then no wonder nothing shows up.

    This is a complete Loop with template tags (the template tags call the any content from the DB)
    http://www.transycan.net/abc/loop.phps

    Thread Starter TomJohnson

    (@tomjohnson)

    Oh, I see. I tried doing that and I think I got it to work. Now I just need to experiment with putting the loop inside table cells. I want my 5 main categories to be divided up like this: http://www.rockleybulletin.com/

    Any tips for me?

    5 loops. See the Multiple Loops examples > The_Loop.
    Alternatively, get familiar with the Template_Tags/query_posts.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘dividing the index page into table cells’ is closed to new replies.