How to create custom page template in wordpress

how to create custom page template in wordpress

Creating a custom page template in WordPress allows you to have unique layouts and functionality for specific pages on your website. Here are the steps to create a custom page template

Step 1: Choose a Theme

First, make sure you’re using a WordPress theme that supports custom page templates. Most modern themes should support this feature. If you’re unsure, check your theme’s documentation or consult with the theme developer.

Step 2: Create a New Template File

Access your WordPress site’s files. You can do this via FTP or by using your hosting provider’s file manager.

Navigate to your WordPress theme directory. This is typically located in /wp-content/themes/your-theme-name/. Replace your-theme-name with the actual name of your theme.

Inside the theme directory, create a new PHP file with a name that reflects your custom page template. For example, if you want to create a template for a “Portfolio” page, you might name it template-custom.php.

Step 3: Add Template Header

In your newly created template file, add the following header at the top:

<?php
/**
 * Template Name: Custom Template
 *
 * Description: A custom template for your Learn Tutorials Point page.
 */
get_header(); // Include the site header
?>

<div id="primary" class="content-area">
    <main id="main" class="site-main">
        <section class="portfolio-section">
            <!-- Your Learn Tutorials Point content goes here -->
        </section>
    </main>
</div>
<?php
get_footer(); // Include the site footer
?>

Customize the code to create the specific layout and features you want for your custom page.

Step 4: Save and Upload the Template

Save your custom page template file and upload it to your WordPress theme directory if you haven’t done so already.

Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact us

Fill in the form below or give us a call and we'll contact you. We endeavour to answer all enquiries within 24 hours on business days.