Simple way to create a custom layout in wordpress theme

I was always thinking how some people create completely different looking pages on their WordPress theme. Currently we see that from an static page to ecommerce site is developed using WordPress package. Many sites has different layout for different pages. WordPress provide a simple solution to create custom layout for our website built on wordpress. A custom layout of wordpress page is helpful if we want to have a layout that looks completely different than rest of our blog but still executes on WordPress CMS.

In this tutorial I will try to describe you how we can create a custom page in WordPress using the custom page template snippet.

Lets create a custom page by opening a blank file in an editor. In the very beggining of the page paste the following code:

For example:

Lets save the page as: custom_layout_1.php. The above code is simply giving a name to the template. so we can call our template MyCustomLayout1, but you can call it whatever you like for example: archive, contact, landingpage etc.

After the Template Name code you can start out by calling WordPress header and footer, Even you can use everything in HTML to built an static design. To use the custom layout dynamically we must implement some of our general knowledge with php.

page-attributes-wordpress

 

Once you have completed editing this file & save it. Go to the Admin panel to create a new page with the custom layout we have created as “MyCustomLayout1”. From the beggining go Pages -> Add New . Complete the necessary fields. Now we need to define the custom “MyCustomLayout1″ layout for this page.

You can see Template Select Dropdown in the right “Page Attributes” bar. Select the MyCustomLayout1 option in that Template Select Dropdown & Publish it.

Share with:

Categories: Wordpress