Setting of PHP Files Structure in WordPress Theme Development (Lesson – 2)

Welcome back! I am Rashad form w3p and a student of zend php program. Actually in my last tutorial I did not done anything in theme development nothing but installed wordpress cms for w3p in my laptop machine. And that was really a very very first step to wordpress theme development.

The Basic File System of WordPress Theme:

Now I am going to arrange basic file system in my wordpress theme development. In the basic file system, we will use the most common files for wordpress responsive theme, each of which play their respective part in the displaying or functionality of a theme.

style.css

style.css is integrating with wordpress cms and if you have only style.css file in your theme directory then wordpress is counting a theme. Visit this forum topic to code wordpress basic child style sheet code.

header.php

Header part of wordpress is the common part of a website. In header.php you can contains the website header part until </head> and the function wp_head() is most important hook of wordpress header.

sidebar.php

An optional file called by the use of get_sidebar(), you can use this file for a sidebar, navigation or anything similar. The code to allow widgets to run in your WordPress, if your theme founction allows them.

footer.php

This part is also a common part of your website and wordpress cms.  This is where the theme wraps up and also where you can register a second area for widgets to display. Of course you can display widgets anywhere you want, but header, sidebar and footer are the most common.

page.php

page.php is used to display a single page – not to be confused with a wordpress post.

single.php

single.php is post file of wordpress, used to display a single blog post/custom post type,  but very similar to page.php in code.

index.php

Great, now come to index.php, which does the chunk of the work for a blog; displaying posts, search results, serving up error messages and so on.

functions.php

In function.php, you can write your own functions and hooks to your theme. They are most commonly used to create section, register menu, widget, post type, image size anything you can function it in wordpress cms.

comments.php

Displays a loop similar to index.php which integrate through comments. This is also where trackbacks, nested comments and other related functionality is performed.

You can use as many as files you need in your theme. But the above files are most common to use a WordPress theme. And the theme files structures is the decision of the theme developer. Also you can use to display video.php, audio.php, author.php, fullwidth.php etc… you like to.

I forgot to show something to create an example files structure of w3pro theme. Now I am going to w3pro>>wp-content>>themes folder in my local directory  and create a new theme folder for our theme w3pro>>wp-content>>themes>>w3pro. Below image will help you to understand:

create-theme-folder

In the blow image are showing the most common and basic files for our new WordPress theme.

most-common-theme-files

Put the below comment in style.css file and go to wordpress admin Appearance>>themes to active the theme.


/*
Theme Name: w3Programmers
Theme URI: N/A
Description: Most Popular Tutorial For World Wide Web Programmers
Author: Rashad
Author URI: http://itsrashad.info
Template: w3pro
Version: 1.0
*/

active-wordpress-theme

Great! Great! Great! Today we learn theme files structure and active our theme with WordPress cms. Next week ……

Hello, This is Rashad. I like programming.
Print Friendly

Leave a Reply

Your email address will not be published. Required fields are marked *