Monday, July 21, 2014

If you want to customize any of the pages of your WordPress site you have to follow some instructions. Today I’ll share the easy instructions to you.
At first copy the page.php file from your theme. Then paste it at same place. It will be “page - Copy.php”. Now rename the file as “your-template-name.php”. Now open it using Notepad + +. Find out -
                                                <?php get_header(); ?>                                                                           
Replace this code with 
<?php                                                                                                                                                     
/*                                                                                                                                                            
Template Name: Custom Template                                                                                                          
 */                                                                                                                                                           
get_header(); ?>                                                                                                                                     
Now find out these codes –
<?php while ( have_posts() ) : the_post(); ?>                                                                                          
                                                            <?php get_template_part( 'content', 'page' ); ?>                          
                                                <?php endwhile; ?>                                                                                
Replace these codes with your own custom design’s code.
Now include styles of your newly added code in your theme’s style.css.
You have just created your own custom template. Now go to your dashboard, click on Add New Page. You will get a new option in your page editor named “Template”. Chose your newly created custom template from the list and publish the page.

Now view your page and check if it is working. 

0 comments:

Post a Comment