php – inner-wrap div pushing custom table far down on page

Question

I am working with code in a custom child-theme. My goal is to pull data from the wpdb and display it as a custom table.
I have created and populated the custom wpdb table with the relevant data, and I am creating the table. However, in the parent theme header styles files, there is a div:

<div id="inner-wrap" class="wrap hfeed kt-clear">
    <?php
    /**
     * Hook for top of inner wrap.
     */
    do_action( 'kadence_before_content' );
    ?>

that seems to take up a large chunk of the page before my table loads. It always takes up the entire page and forces me to scroll down to see the start of my table. No matter how I zoom in or out, I always need to scroll to even see the start.
I have tried assigning my custom table the same ID and Class from that header div, but that has not worked.

The current code to create my table, is located in a custom php file that is used as the template for the page in question. The code looks like this:

<table id = "inner-wrap" class="empTable" border="1">
<tr>
 <th>Name</th>
 <th>ID</th>
 <th>Active</th>
</tr>
    
<?php
   /*
    Template Name: Custom Table 
   */
get_header();
    global $wpdb;
    $result = $wpdb->get_results ( "SELECT * FROM DBTable" );
    foreach ( $result as $print )   {
        echo '<tr>';
        echo '<td>', $print->name,'</td>';
        echo '<td>', $print->id,'</td>';
        if($print->active == 1){
            echo '<td>', 'Active','</td>';
        }else{
            echo '<td>', 'Inactive','</td>';
        }
        echo '</tr>';
        
    }echo '</table>';

get_footer();

0
user228625 1 month 2022-12-28T10:55:52-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse