Home > Wordpress Development > Creating Template page

Creating Template page

Hello Readers, I am back after a long time today will give you a short tutorial for the wordpress custom template page.
Firstly remember the changes which would be done are template specific. So if the template changed ,changes are gone.
firstly go into the template folder ie

yoursiteaddres/wp-content/themes

So for now i m considering the default template for wordpress 3.0 is twentyten. Now create a empty file inside the the twenty ten folder .

new_template.php

Now we have the custom template which do not contain any code. but now you might be thinking where to access this template file . But wait this file wont show up into the wordpress admin area unless u write the following code.

/*
Template Name: new template
*/

now we could say we have a template page installed on to the wordpress current theme . You could write any html code or could copy the content from the page.php and delete the content which you don want to display . So now will add the following code.

<?php
/*
Template Name: new_template
*/
get_header();?>
 <div id="container">
 <div id="content" role="main">

      This is a  custom Template Page
      <!-- Any HTML Content Here -->
 </div>
 </div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

As you can see above will give the same look as the other but here you have freedom to write any static or call any php function or any functionality you want to extend to this template or wordpress. So now we have a complete page where we could have our custom page.So now its time to access this new template page. Step1: Got the Pages->Add New Step 2: Select the new template created . Template page As you can see you will get the template page that we created into the combobox. So now do not enter any content into the page just leave blank and select the template page and publish the page. Then from the main menu you could see the menu is created and also the content you have added . Thank you all for reading hope you it could have been a useful article.

Advertisements
  1. apoorva
    March 3, 2011 at 11:43 am

    Nice! You are really getting regular with this blog…Lol..now if only I could understand any of it…but for people who can…this is pretty good 😀
    jamtay 😛

    • March 6, 2011 at 4:17 pm

      lol thanx.. pahu i m going to write general blogs too that all ppl could learn n i could also learn much more thing 🙂

  1. April 18, 2011 at 3:09 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: