Saturday, May 19, 2012

How to make wordpress Templates

Posted by admin On April - 24 - 2010 ADD COMMENTS

When we talk about the wordpress templates  its to customize the look of  wordpress themes , if we want to make the page looks  different from the   regular pages  then we assign  a page  templates  for a particular  page .page  templates are needed to give   professional look of the  web site and  , page   templates allow easy customization of pages  and  a look totally  on our wish .its   good way to make  custom pages.well  templates is good way to make professional look.. lets learn  here  how to  make it

to make a  template we need  to assign a name of the   templates as that wordpress recognize it

<?php

/*

Template Name:forum

*/

<div id=”casing”>

get_header();

if(have_posts())while(have_posts()){the_post();the_content();}

</div>

get_footer();

?>

this is simple  page template   named  forum.php

if we  want to make page template from  the  default page  template   then  open –> page.php file  of  wordpress theme

put the template name  on the top of the  code  after php tag

<?php

/*

Template Name:forum

*/

rest of the code………

?>

now  save it as   as   the name of the  template here use   forum.php

Now giving example   of existing  code    page.php

<?php get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content”>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div id=”post-<?php the_ID(); ?>”>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

now we  make it as page  templates   test.php  by editing  code and  removing the code that we not want on the   to see   in the page  .


<?php

/*

Template Name:test

*/

get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content1″>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_footer(); ?>

upload in the theme directory  and  assign the page template for  any page we wish .

<?php

/*

Template Name:forum

*/

<div id=”casing”>

get_header();

if(have_posts())while(have_posts()){the_post();the_content();}

</div>

get_footer();

?>

this is simple  page template   named  forum.php

if we  want to make page template from  the  default page  template   then  open –> page.php file  of  wordpress theme

put the template name  on the top of the  code  after php tag

<?php

/*

Template Name:forum

*/

rest of the code………

?>

now  save it as   as   the name of the  template here use   forum.php

Now giving example   of existing  code    page.php

<?php get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content”>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div id=”post-<?php the_ID(); ?>”>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

now we  make it as page  templates   test.php  by editing  code and  removing the code that we not want on the   to see   in the page  .


<?php

/*

Template Name:test

*/

get_header(); ?>

<div id=”foxmenucontainer”>

<div id=”menu”>

<ul>

<?php wp_list_categories(’sort_column=name&title_li=&depth=4′); ?>

</ul>

</div>

</div>

<div id=”casing”>

<div id=”content1″>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<div>

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h2>

</div>

<div>

<div>

<?php the_content(‘Read the rest of this entry &raquo;’); ?>

<div></div>

<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages: </strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

</div>

</div>

<?php endwhile; endif; ?>

</div>

<?php get_footer(); ?>

upload in the theme directory  and  assign the page template for  any page we wish .

Popularity: 19% [?]

improve your SEO potential

For most people the upcoming holiday season will be one for relaxing and spending quality time with the family. But, [...]

Open source CMS

nomey
Cross-platform
Anomey is a small but effective framework and CMS for developing and maintaining web sites. (GPL)
BIGACE
Cross-platform
BIGACE is a multi-site, multi-language and [...]

Web Development / Frameworks

Bitweaver
Cross-platform
Bitweaver is a free and open source web application framework and content management system. (LGPL)
CakePHP
Cross-platform
CakePHP is a rapid development framework for [...]

Web Development Utilities

CKeditor
Cross-platform
This HTML text editor brings to the web much of the power of desktop editors like MS Word. It’s lightweight [...]

TAG CLOUD


Fatal error: Call to undefined function get_theme_option() in /home/sitescod/public_html/wp-content/themes/chronicle/footer.php on line 14