How to create custom page templates in WordPress? It's easy even without a plugin. This will enable you to have different WordPress page templates for different pages.
The code for custom WordPress page you will need to enter in PHP file in:
/* Template Name: custom full width page */
And place it in /wp-content/themes/yourthemename
----------------
My website setup recommendations: [ Ссылка ]
Support the channel:
on Amazon: [ Ссылка ]
PayPal tip jar: [ Ссылка ]
-----------------
VIDEO TRANSCRIPT:
Alright, before we start, I just want to mention that you need to have access to your server for this to work, so make sure you can connect to it by using file manager or FTP software like FileZilla.
This will even work on managed WordPress hosting because we are going to change only files inside your theme, but just with the FTP, if you don’t know how to connect to FTP with managed hosting, check out the video that appears on your screen now.
So let’s get started:
1. I’m going to use a file manager, but it’s very similar to FTP.
2. Just go to your cPanel, and click on file manager,
and then go inside the folder with your domain name.
3. If you are on FTP, this applies to you too. Now you might need to go inside the public_html folder to see it, in my case, it’s an as separate folder.
4. And go to folder /wp-content/themes/. And select your theme.
5. Now, I advise you to add it to your child theme if you have one. If not, then add it to the original theme.
6. Here you should see a file named page.php, this file is the template for all the pages that WordPress uses by default.
7. So what we can do is just right click on the file, and create a copy. Or you can also create a new file, it doesn’t really matter.
8. Then just rename the file to whatever you want, but try to keep it descriptive. I’ll call my file full-with-page.php.
9. Now, let’s right-click on the new file and choose edit.
10. What you see here is your page template, it might shorter than what I have, or it might be longer. It really depends on your theme, but for WordPress to recognize this as a page template, we need to add this code on a new line just below the PHP opening tag.
/* Template Name: custom full width page */
If you create a new page, then you need to add PHP opening and closing tags
11. Just replace the “custom full-width page” with your own name, this is what your template will be called in WordPress dashboard. 12. You don’t need to worry about the rest of the code for now.
13. Now go to your WordPress dashboard
and go to pages & create a new page
14. And here on the right, you have the page attributes section, if you are missing it, just click on the little arrow here at the top and enable page attributes.
15. So in this section, you have page templates dropdown, if you click in it, you will see your custom page template! Now, keep in mind, if you go to this test page, it won’t look any different from your normal page because we didn’t customize it yet.
16. So now you can edit anything on this page and customize the page template to whatever you want. So for example, if I want to make this full-width page, I would just add a few CSS classes and this would be a new template just for full-width content.
You can get really creative with the custom templates.
How to Create Custom Page Template in Wordpress
Теги
create custom page template in wordpresswordpress add page templatewordpress page templatehow to add template option in page attributes in wordpresshow to create custom page in wordpress admin panelcustom wordpress pagewordpress page phpwordpress custom page templatecustom page layoutpage templatecustomize page templatetwptipswithpunchwordpress custom page php codewordpress page template tutorialwordpress page template createhow-to (website category)