I have a following code which I have written to convert the download monitor output to html table.
<div class="table-1">
<table width="100%">
<thead>
<tr>
<th>Lab Title</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php $dlm_download->the_title(); ?></td>
<td><a href="<?php $dlm_download->get_the_download_link(); ?>">
<?php $dlm_download->the_title(); ?> (<?php echo $dlm_download->get_the_download_count(); ?>)</a></td>
</tr>
</tbody>
</table>
</div>
however this gives me the output as shown below
how can I modify code so the table headers aren't repeated for every download.
Update: here's the php code
<?php global $dlm_page_addon; ?>
<div class="download_category download_group">
<!-- <h3><a href="<?php // echo $dlm_page_addon->get_category_link( $category ); ?>"><?php //echo $category->name; ?> <?php //if ( $category->count ) : ?>(<?php //echo $category->count; ?>)<?php //endif; ?></a></h3> -->
<?php while ( $downloads->have_posts() ) : $downloads->the_post(); ?>
<?php $dlm_download = new DLM_Download( get_the_ID() ); ?>
<?php $template_handler = new DLM_Template_Handler(); $template_handler->get_template_part( 'content-download', $format, $dlm_page_addon->plugin_path() . 'templates/', array( 'dlm_download' => $dlm_download ) ); ?>
<?php endwhile; ?>
</div>
As far as I understand, this code passes the array $dlm_download to the template. The template code is the one with the table and has repeating table headers. I want to have a three column table with download title, category and download link.
Replace <th></th>
tags with <td></td>
and use <strong>Content</strong>
<div class="table-1">
<table width="100%">
<thead>
<tr>
<td><strong>Lab Title</strong></td>
<td>Download</td>
</tr>
</thead>
<tbody>
<tr>
<td><?php $dlm_download->the_title(); ?></td>
<td><a href="<?php $dlm_download->get_the_download_link(); ?>">
<?php $dlm_download->the_title(); ?> (<?php echo $dlm_download->get_the_download_count(); ?>)</a></td>
</tr>
</tbody>
</table>
</div>