WordPress.org

Support

Support » Themes and Templates » [Resolved] Twenty Fourteen display custom post type in two column layout

[Resolved] Twenty Fourteen display custom post type in two column layout

  • Hello all WordPress experts! I am trying to display a custom post type and have the query display in a two column table format on the page. Currently I’ve been able to get it to display in separate rows but not columns and the table displays twice for some reason. I know this may involve some serious coding and I am fairly adept at PHP but am still learning. Here is the link to the page in question: http://new.ynp2.com/pet-list/ Below is the code that I currently have, any help would be appreciated:

    <table>
        <tbody>
                <?php $listings = new WP_Query( array('post_type' => 'phanimals') ); if( $listings->have_posts() ): while($listings->have_posts()): $listings->the_post(); ?>
                <tr>
                <td>
                         <?php
                                        // now get and display custom fields
                                        $tour_custom_fields = get_post_custom();
                                        if (trim($tour_custom_fields['Pup Name']['0']) != "") { ?>
                                               <h4><? echo $tour_custom_fields['Pup Name']['0']; ?></h4>
    <?php
    // Page thumbnail and title.
    twentyfourteen_post_thumbnail();
    ?>
    <br>
    
    <?php }
               if (trim($tour_custom_fields['Date of Birth']['0']) != "") {
                        $tmpage = calculate_age_from_dob($tour_custom_fields['Date of Birth']['0']);
                        $tmpdob = calculate_friendly_dob($tour_custom_fields['Date of Birth']['0']);
                        echo '<span class="attrname">Age: </span><span class="attrval">' . $tmpage . '</span><br>';
                        echo '<span class="attrname">D.O.B.: </span><span class="attrval">' . $tmpdob . '</span><br>';
                                        }
    ?>
    
    <?php echo get_the_term_list( $post->ID, 'animal_species', 'Species: ', ', ', '</p>' ); ?>
    <?php echo get_the_term_list( $post->ID, 'animal_gender', 'Gender: ', ', ', '</p>' ); ?>
    <?php echo get_the_term_list( $post->ID, 'animal_allergy_scales', 'Allergy Scale: ', ', ', '</p>' ); ?>
    <?php echo get_the_term_list( $post->ID, 'animal_activity_levels', 'Activity Level: ', ', ', '</p>' ); ?>
    <?php echo get_the_term_list( $post->ID, 'shedding', 'Shedding: ', ', ', '</p>' ); ?>
    <?php echo get_the_term_list( $post->ID, 'weight_range', 'Weight Range: ', ', ', '&nbsp;lbs.</p>' ); ?>
    <?php echo get_the_term_list( $post->ID, 'expected_size', 'Expected Size: ', ', ', '&nbsp;lbs.</p>' ); ?>
    </div>
    
        <div class="entry-content3">
                <?php
                        the_content();
                        wp_link_pages( array(
                                'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
                                'after'       => '</div>',
                                'link_before' => '<span>',
                                'link_after'  => '</span>',
                        ) );
    
                        edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' );
                ?>
    
        </div><!-- .entry-content -->
    </article><!-- #post-## -->
    
                <?php endwhile; endif; ?>
    
                </td>
                </tr>
    
        </tbody>
        </table>

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Twenty Fourteen display custom post type in two column layout’ is closed to new replies.