StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have -- and this forum will be removed on July 1st, 2013.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-15-2011, 08:52 PM
foodin65 foodin65 is offline
Registered User
GenesisConnect
Genesis Member
Pro Plus Member
 
Join Date: Jun 2009
Location: Columbia, MO
Posts: 14
Default Need Help With A Custom Post Type Archive Template

Hello All,

I'm working on creating a custom post type archive template that shows all of the archive data in a sortable/filterable table.

So far, I've managed to make the template and get the data to show in Table format, but I've run into a snag... my code is making a complete separate table for each post.

Here's what I mean:


That's image shows three complete tables, because I've got three posts in that post type. If I had four, I'd have four tables. I only want one table with all of the post type data in it.

here's the code I'm using to generate the data in the template:
PHP Code:
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

<!--Start Blog Post Coding-->
<div class="postcontent">
      <div id="mastertasktable">
        <table id="mastertasktable" cellpadding="0" cellpadding="0">
           <thead>
            <th axis="number">Task #</th>
            <th axis="title">Title</th>
            <th axis="assigned">Assigned To</th>
            <th axis="status">Status</th>
            <th axis="time">To Be Completed Within</th>
            <th axis="time">Max Hours Allotted</th>
            <th axis="time">Hours Spent</th>
         </thead>
         <tbody>
            <?php $myposts get_posts( array( 'post_type' => 'tasks','numberposts=-1;offset=0'));foreach($myposts as $post) :?>
            <? $stt $stt 1?>
            <tr id="<?php $stt ?>">
               <td align="center"><?php echo get_post_meta($post->ID'ecpt_task#'true); ?></td>
               <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
               <td align="center"><?php echo get_post_meta($post->ID'ecpt_assignedto'true); ?></td>
               <td align="center"><?php echo get_post_meta($post->ID'ecpt_status'true); ?></td>
               <td align="center"><?php echo get_post_meta($post->ID'ecpt_tobecompletedwithin'true); ?></td>
               <td align="center"><?php echo get_post_meta($post->ID'ecpt_maxhoursallotted'true); ?></td>
               <td align="center"><?php echo get_post_meta($post->ID'ecpt_hoursspent'true); ?></td>
            </tr>
            <?php endforeach; ?>
         </tbody>
         <tfoot>
            <tr>
               <td></td>
               <td></td>
               <td></td>
               <td></td>
               <td></td>
               <td></td>
               <td></td>
            </tr>
         </tfoot>
        </table>
      </div>

</div><!--close postinfo-->
<div class="aclear"></div>

</div><!--close postcontent-->

<!--End Blog Post Coding-->

<?php endwhile; ?>
I'd love to know what I need to change so that I've only got one beautiful table showing all of the custom data from my post type.

Other information that might be useful:
WP 3.2.1
Any Genesis Theme, I've got 'em all...
Custom Post Type created by: Easy Content Types

After I get this sorted out, I'd love some help implementing the JS that will sort the table data.
__________________
23 Year Old Ex-Professional on a Mission to Free all the dads of the world from the chains and drudgery of the 9-5 world!
http://www.monetizemylife.com
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:18 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.