{"id":67,"date":"2022-03-22T20:11:51","date_gmt":"2022-03-22T20:11:51","guid":{"rendered":"https:\/\/www.normanbalberan.com\/blog\/?p=67"},"modified":"2022-03-31T15:05:54","modified_gmt":"2022-03-31T15:05:54","slug":"how-to-create-a-page-template-for-a-wordpress-website","status":"publish","type":"post","link":"https:\/\/www.normanbalberan.com\/blog\/how-to-create-a-page-template-for-a-wordpress-website\/","title":{"rendered":"How to Create a Page Template for a WordPress Website"},"content":{"rendered":"<figure id=\"attachment_68\" aria-describedby=\"caption-attachment-68\" style=\"width: 890px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-68\" src=\"https:\/\/www.normanbalberan.com\/blog\/wp-content\/uploads\/2016\/10\/wordpress-page-template.jpg\" alt=\"wordpress page template\" width=\"900\" height=\"675\" srcset=\"https:\/\/www.normanbalberan.com\/blog\/wp-content\/uploads\/2016\/10\/wordpress-page-template.jpg 1200w, https:\/\/www.normanbalberan.com\/blog\/wp-content\/uploads\/2016\/10\/wordpress-page-template-300x225.jpg 300w, https:\/\/www.normanbalberan.com\/blog\/wp-content\/uploads\/2016\/10\/wordpress-page-template-768x576.jpg 768w, https:\/\/www.normanbalberan.com\/blog\/wp-content\/uploads\/2016\/10\/wordpress-page-template-1024x768.jpg 1024w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><figcaption id=\"caption-attachment-68\" class=\"wp-caption-text\"><center><a href=\"http:\/\/codex.wordpress.org\/WordPress_Screenshots\" target=\"_blank\"><span style=\"font-size: small;\">WordPress Screenshots<\/span><\/a> \/ <a href=\"https:\/\/creativecommons.org\/licenses\/by-sa\/3.0\/deed.en\" target=\"_blank\"><span style=\"font-size: small;\">CC BY-SA 3.0<\/span><\/a><\/center><\/figcaption><\/figure>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.normanbalberan.com\/blog\/how-to-create-a-page-template-for-a-wordpress-website\/#Creating_a_WordPress_Page_Template\" >Creating a WordPress Page Template<\/a><ul class='ez-toc-list-level-6' ><li class='ez-toc-heading-level-6'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.normanbalberan.com\/blog\/how-to-create-a-page-template-for-a-wordpress-website\/#Step_1\" >Step 1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-6'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.normanbalberan.com\/blog\/how-to-create-a-page-template-for-a-wordpress-website\/#Step_2\" >Step 2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-6'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.normanbalberan.com\/blog\/how-to-create-a-page-template-for-a-wordpress-website\/#Step_3\" >Step 3<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-6'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.normanbalberan.com\/blog\/how-to-create-a-page-template-for-a-wordpress-website\/#Step_4\" >Step 4<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h5 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Creating_a_WordPress_Page_Template\"><\/span>Creating a WordPress Page Template<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p style=\"text-align: justify;\"><strong>A template is a PHP file stored in your website\u2019s WordPress directory that contains information WordPress needs to format your pages in a specific manner.<\/strong> For example, if you want all the posts in a specific category on your website to have a particular format that is different from the default format, you can create a custom page template and upload it to your directory. Once uploaded, the page template will become visible within the WordPress content management system, where you can select it before publishing a page to easily format the text and images contained within.<\/p>\n<h6 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Step_1\"><\/span>Step 1<span class=\"ez-toc-section-end\"><\/span><\/h6>\n<p style=\"text-align: justify;\">Open <strong>Notepad<\/strong>, the default text editor included on all versions of Windows. Click \u201c<strong>File<\/strong>,\u201d then \u201c<strong>Save as<\/strong>.\u201d <strong>Enter the name of the page template<\/strong> that you\u2019re going to make into the text field, then add \u201c<strong>.php<\/strong>\u201d to the <strong>end of the name<\/strong>. For example, if your page template is named Template, the file should be saved with the name \u201ctemplate.php.\u201d<\/p>\n<h6 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Step_2\"><\/span>Step 2<span class=\"ez-toc-section-end\"><\/span><\/h6>\n<p style=\"text-align: justify;\"><strong>Type the following code at the top of the text file<\/strong>, which is necessary for WordPress to recognize it as a page template: Once entered, save the changes. Beneath the text in this file, you can enter the page template information you want using <strong>WordPress\u2019 custom coding<\/strong> and standard <strong>PHP<\/strong>. You can enter the code that affects only a small portion of the page, or you can create a <strong>PHP script<\/strong> that alters all the elements on the page. Once you\u2019ve created the <strong>PHP template<\/strong> that you want, click \u201c<strong>Save<\/strong>,\u201d then close <strong>Notepad<\/strong>.<\/p>\n<h6 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Step_3\"><\/span>Step 3<span class=\"ez-toc-section-end\"><\/span><\/h6>\n<p style=\"text-align: justify;\"><strong>Open your WordPress directory using either your favorite FTP application<\/strong> or your website host\u2019s online FTP Java app. Transfer the <strong>PHP page template<\/strong> file that you create into the \u201c<strong>Themes<\/strong>\u201d folder within the WordPress directory. Make sure the file has transferred in its entirety before you close the <strong>FTP program<\/strong>.<\/p>\n<h6 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Step_4\"><\/span>Step 4<span class=\"ez-toc-section-end\"><\/span><\/h6>\n<p style=\"text-align: justify;\"><strong>Log in to your WordPress control panel<\/strong> and either select one of your existing pages or create a new page. At the bottom of the page, choose the new page template that you created from the \u201c<strong>Template<\/strong>\u201d drop-down menu.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a WordPress Page Template A template is a PHP file stored in your website\u2019s WordPress directory that contains information WordPress needs to format your pages in a specific manner. For example, if you want all the posts in a specific category on your website to have a particular format that is different from the &#8230; <a title=\"How to Create a Page Template for a WordPress Website\" class=\"read-more\" href=\"https:\/\/www.normanbalberan.com\/blog\/how-to-create-a-page-template-for-a-wordpress-website\/\" aria-label=\"Read more about How to Create a Page Template for a WordPress Website\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":68,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,1],"tags":[74,19],"class_list":["post-67","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","category-web-development","tag-page-template","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":0,"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/media\/68"}],"wp:attachment":[{"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.normanbalberan.com\/blog\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}