WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display Excerpts in Table (3 posts)

  1. x9tripboarder16
    Member
    Posted 7 years ago #

    I don't know if this is possible, but I am creating a wordpress site where I want to display excerpts from my posts in a table whereas there are 3 columns, and an unlimited number of rows (defined in the reading options panel). In each of the columns on the first row, I want the next post.

    In other words column 1 of row 1 has the first post, column 2 of row 1 has post 2, and column 3 of row 1 has post 3. Does anyone have any ideas? Thanks in advance!

  2. x9tripboarder16
    Member
    Posted 7 years ago #

    I figured it out with some help. Define a table whereas you just use the <table> tag. Then put in the following code:

    <?php while (have_posts()) :
    echo "<tr>\n";
    for ($i = 0; $i < #; $i++) :
    the_post();
    echo "<td>\n";
    echo $post->post_excerpt;
    echo "
    \n";
    echo $post->post_title;
    echo "</td>\n";?>
    <?php endfor; echo "</tr>\n"; endwhile; echo "</table>\n"; ?>

    Where the # is the number of columns.

  3. moseymosey
    Member
    Posted 7 years ago #

    Thanks :D I think this will help alot.

Topic Closed

This topic has been closed to new replies.

About this Topic