php - How can I edit a WP custom template file with a custom table?

one text

Solution:

Each solution depends on what you need.

Solution 1

<?php
//  the_post();
    get_template_part( 'template-parts/content/content-page' );
// my added table
//This is hard to manage if we work with alot of data or loops etc.
echo '<table><th></th><th></th></table>';

// end added table
    // If comments are open or there is at least one comment, load up the comment template.
    if ( comments_open() || get_comments_number() ) {
        comments_template();
    }
endwhile; // End of the loop.

get_footer();

Solution 2

Open file content-page.php located in yourtheme/template-parts/content and add your table there

<?php
//  the_post();
    get_template_part( 'template-parts/content/content-page' );

// end added table
    // If comments are open or there is at least one comment, load up the comment template.
    if ( comments_open() || get_comments_number() ) {
        comments_template();
    }
endwhile; // End of the loop.

get_footer();

Solution 3

Create new template in yourtheme/template-parts/content for example content-table.php and load it

<?php
//  the_post();
    get_template_part( 'template-parts/content/content-page' );
    get_template_part( 'template-parts/content/content-table' );

// end added table
    // If comments are open or there is at least one comment, load up the comment template.
    if ( comments_open() || get_comments_number() ) {
        comments_template();
    }
endwhile; // End of the loop.

get_footer();

Source