There are around 12 core files. Here is Overview of the main files you will be working with:
• Header.php – Contains everything you’d want to appear at the top of your site.
• Index.php – The core file that load your theme, also act as the homepage.
• Functions.php – A file that can be used to configure the wordpress core,
Without editing core files.
• Sidebar.php – Contains everything you’d want to appear in sidebar.
• Footer.php – Contains everything you’d want to appear at the bottom of your site.
• Archive.php – The template file used when viewing categories, dates, posts by author,etc.
• Single.php – The template file used when viewing the individual post.
• Comments.php – Called at the bottom of single.php file to enable the comments section.
• Page.php – Similar to single.php
• Search.php – The template file used to search display search results.
• 404.php – The template file that display when a 404 error occurs.
• Style.css – All the styling goes here.
Each of these files contains series of php template tag. By using these tags we can insert dynamic content.
• Configuring the stylesheet
All the details of a WordPress theme are contained within the stylesheet. At the top of your style.css add the following code.
/* Theme Name: Vibidsoft Theme URI: http://www.vibidsoft.in/ Description: Vibidsoft WordPress theme Version: 1 Author: Vibidsoft Author URI: http://www.vibidsoft.in/ */
index.php
Open the index.php, add this piece of code and save the file:
<?php get_header(); ?> <div id="container"> <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> <p class="postmetadata"> <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?><br /> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?> </p> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php posts_nav_link(); ?> </div> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
The index-file now contains the code that calls to the header, sidebar and footer template files
header.php
Open the header.php, add this piece of code and save the file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head profile="http://gmpg.org/xfn/11"> <title><?php bloginfo('name'); ?><?php wp_title(); ?></title> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please --> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <?php wp_get_archives('type=monthly&format=link'); ?> <?php //comments_popup_script(); // off by default ?> <?php wp_head(); ?> </head> <body> <div id="wrapper"> <div id="header"> <h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1> <?php bloginfo('description'); ?> </div>
footer.php
Open the footer.php, add this piece of code and save the file:
<div id="footer"> <p> Copyright 2007 <a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a> </p> </div> </div></body> </html>
sidebar.php
Open the sidebar.php, add this piece of code and save the file:
<div class="sidebar"> <ul> <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?> <?php wp_list_pages('depth=3&title_li=<h2>Pages</h2>'); ?> <li><h2><?php _e('Categories'); ?></h2> <ul> <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?> </ul> </li> <li><h2><?php _e('Archives'); ?></h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </li> <?php get_links_list(); ?> <?php endif; ?> </ul> </div>
Leave a Reply
You must be logged in to post a comment.