Support » Themes and Templates » Dynamic Content in a Table

  • Resolved rebecca-paisley

    (@rebecca-paisley)



    I’m attempting to pull specific fields into a table dynamically. It’s a custom post type “sec-filings” which as 4 custom fields that need to be pulled into a table format.

    Not sure if I’m just overlooking something really simply or what.

    <?php
    /**
     * Template Name: Main SEC Filings
     *
     */
    ?>
    
    <?php
    global $avia_config;
    
    	/*
    	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    	 */
    	 get_header();
    
     	 if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
    
     	 do_action( 'ava_after_main_title' );
    	 ?>
    
    		<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    
    			<div class='container'>
    
    				<main class='template-page content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'sec-filing'));?>>
    
    <table>
    				<tr>
    					<th>Date</th>
    					<th>Form</th>
    					<th>Description</th>
    					<th>Downloads</th>
    				</tr><tr>
                                            <td><?php the_date(); ?></td>
    					<td><?php
    						echo types_render_field("form_type", array("output" => "raw"))
    						?></td>
    					<td><?php
    						echo types_render_field("file-name", array("output" => "raw"))
    						?></td>
    					<td><?php echo types_render_field("file-name", array("output" => "raw")) ?>
    <a href="<?php echo types_render_field("downloads", array("title" => "view")) ?>" style="padding-left:20px;">View File</a></td>
    				</tr></table>
    
    				</main>
    
    				<?php
    
    				//get the sidebar
    				$avia_config['currently_viewing'] = 'page';
    				get_sidebar();
    
    				?>
    
    			</div><!--end container-->
    
    		</div><!-- close default .container_wrap element -->
    
    <?php get_footer(); ?>

    I know I am missing the “get_posts” and “while_have_posts” in this page template – Every time I add them, it breaks the page, which makes me think I am probably putting it in the wrong spot or missing some piece.

    Can anyone help tell me what is missing?

    Much appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Dynamic Content in a Table’ is closed to new replies.