Results 1 to 2 of 2

Thread: Format PHP output into a table???

  1. #1
    Join Date
    Oct 2012

    Format PHP output into a table???

    I am using php with wordpress to create a custom post type (a menu for a restaurant)
    The below code makes the dynamic content I inputted in wordpress admin show up:

    $args = array( 'post_type' => 'restaurant_menu' );
    $loop = new WP_Query( $args );

    while ( $loop->have_posts() ):
    <h3><?php the_title(); ?></h3>
    <?php the_post_thumbnail('thumbnail'); ?>
    <?php the_content(); ?>

    I am wondering if there is a way I can format the output content into a table using another php function or css or whichever way possible. There are 15 posts. I want to make 3 columns, 5 rows.

  2. #2
    Join Date
    Aug 2012
    I would use CSS rather than a table but if you want to use a table (and could be a vild use of a table in this case), this is how you would do it:
    PHP Code:
    $args = array( 'post_type' => 'restaurant_menu' );
    $loop = new WP_Query( $args );

    echo '<table>'

    while ( $loop->have_posts() ):
    <td><h3><?php the_title(); ?></h3></td>
    <td><?php the_post_thumbnail('thumbnail'); ?></td>
    <td><?php the_content(); ?></td>


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center