By: Prem Tiwari | Last Updated:
If you are WordPress beginners then i would suggest to pay close attention in this post, as i am going to explain you How To Create a Custom Page Template in WordPress. This is very easy and simple steps to create your own custom page templates.
WordPress page templates are a specific type of file which you can create within your current theme’s folder that can be applied for a specific page OR groups of several pages.
Bellow are some of features of page templates :
1) Its are used to change the look and feel of a page or group of pages.
2) You have full control over page editing to what template will be render the contents.
3) You can be used for a single page, a page section.
There are several benefits of using page templates like you can display your site’s content dynamically on a page, news updates, calendar events, media files, event videos and much more. Bellow are the common page templates type :
2) Two-column with a sidebar on the right
3) Two-column with a sidebar on the left
5) Full-width page template
Go to your current active theme’s folder and create a
your-template.php page and copy paste bellow code.
* Template Name: Your Template Page Name
* @package WordPress
* @subpackage Twenty_Fifteen
* @since Twenty Fifteen 1.0
Bellow this code add your dynamic contents like text, images, videos etc. Bellow code will display your page contents which you have added from admin panel. Copy paste bellow code and save it.
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
// Post thumbnail.
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php the_content(); ?>
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
</div><!-- .entry-content -->
<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->' ); ?>
</article><!-- #post-## -->
After completed above steps login in your website admin panel and navigate to Pages => Add New. Search Page attributes section and select page template you have created from drop down.
Hope this help you to create a custom page template. Please do like and share with your friends if you like.
Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.View all posts by Prem Tiwari