Hi there,
Here how you should add a template. For example, we are creating a page template called hello
.
At the root level of your Child theme add a new file called template-hello.php
. Copy the code of the template-blank-1.php
at the root of the theme and paste it in the file, Then do proper changes for the template including the name of the template at the top of the file and the name of the file which will be retrieved later:
<?php
// =============================================================================
// TEMPLATE NAME: hello
// -----------------------------------------------------------------------------
// A blank page for creating unique layouts.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's index, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "template-blank-1.php," where you'll be able to
// find the appropriate output.
// =============================================================================
?>
<?php x_get_view( x_get_stack(), 'template', 'hello' ); ?>
<?php x_get_view( x_get_stack(), 'template', 'hello' ); ?>
means that you need to search for a file called template-hello.php
in /framework/views/{Name of the Stack}/
Then add a new file in: wp-content/themes/x-child/framework/views/integrity/template-hello.php
I assumed that you are using the Integrity stack, if not you can change the folder name to the proper stack name.
You will need to create all the folders in the Child Theme.
Now copy the content of the template-blank1.php
inside the framework/views/integrity folder and paste it in the newly added file:
<?php
// =============================================================================
// VIEWS/INTEGRITY/TEMPLATE-BLANK-1.PHP (Container | Header, Footer)
// -----------------------------------------------------------------------------
// A blank page for creating unique layouts.
// =============================================================================
?>
<?php get_header(); ?>
<div class="x-container max width offset">
<div class="x-main full" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-wrap">
<?php x_get_view( 'global', '_content', 'the-content' ); ?>
</div>
</article>
<?php endwhile; ?>
</div>
</div>
<?php get_footer(); ?>
Now check the dashboard:
You can use whatever template that you want as the starting point of your page template. So instead of template-blank-1.php you can use template-blank-2.php for example.
Thank you.