Today we want to talk about WordPress page customization. Let’s say you have implemented on your website a third party theme and you want a new structure with a different look for your content interfaces, well here we show you an easy, fast and very effective way to achieve your purpose.
First of all, we recommend that for any structure or appearance modification within your website through the use of a theme, you consider creating a child theme. This is nothing more than creating your own directory inside the path: wp-content/themes with your own custom files. For more information on creating child themes you can consult: https://codex.wordpress.org/es:Temas_hijos.
However, customizing the look and feel of a content page can be achieved by creating a template.
Let’s start with its structure, inside the chosen directory you will create a new file for example: my-page.php, it should start with the following code:
<?php /* Template Name: My page */
These lines constitute the definition of your template, after the colon you can place the name you want, in this case we have placed that, only as part of the example.
But this will only have created your blank page, and depending on what you want to achieve; You can include the base elements of your theme such as the header, the footer or a sidebar section if required. To do this, simply add get_header(), get_sidebar() and/or get_footer() as shown below:
<?php /** * Template Name: My page */ get_header(); ?> <!-- Elements to be added will be displayed as part of the body of your interface. --> <div id="main-content" class="main-content"></div> <?php get_sidebar(); get_footer();
Of course, the arrangement of these elements will depend on your specific requirements, and whether or not you want to include them. However, with this you will already have a base template to work on to add the elements you want.
Later, when you enter the WordPress administrator to create your content page you will be able to choose the template with that name in the Page Attributes section.
We hope that this small contribution will be of great use to you.