How to create a custom template page on x theme?

Hello guys,

I have to create a custom template page on Wordpress to implement a table built with html and php to take some data from my MySQL database. Once I created a template page using Wordpress guide, I took the php code from page.php in the x theme forlder to apply the theme style to the new template page.

<? Php /* Template Name: Snarfer */ ?> <?php // ============================================================================= // PAGE.PHP // ----------------------------------------------------------------------------- // Handles output of individual pages. // // Content is output based on which Stack has been selected in the Customizer. // To view and/or edit the markup of your Stack's pages, first go to "views" // inside the "framework" subdirectory. Once inside, find your Stack's folder // and look for a file called "wp-page.php," where you'll be able to find the // appropriate output. // ============================================================================= ?> <?php x_get_view( x_get_stack(), 'wp', 'page' ); ?>

How can I implement the table built by me in html?
If I add it before php code, I will have table before and then header and footer.
If I add it after php code, I will have header and footer before and the table at the end of the page.

Hi There,

Please update the template page to this.

<?php
/*
Template Name: Snarfer
*/
?>
<?php

// =============================================================================
// PAGE.PHP
// -----------------------------------------------------------------------------
// Handles output of individual pages.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's pages, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "wp-page.php," where you'll be able to find the
// appropriate output.
// =============================================================================

?>

<?php get_header(); ?>

  <div class="x-container max width offset">
    <div class="<?php x_main_content_class(); ?>" role="main">
		<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		  <div class="entry-wrap">

			<?php 

			// INSERT CODE HERE

			?>

		  </div>
		</article>
    </div>

    <?php get_sidebar(); ?>

  </div>

<?php get_footer(); ?>

We added a comment there where you can insert your code.

Let us know if it works.

Thanks.

Now it is working!!!
Thank you very much for your help

Glad to hear we managed to help!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.