Webbing Wednesdays Week #8
WordPress has evolved to one of the highest installed CMS at this point. The popularity of this CMS has achieved the highest levels of success. It is very important to understand how the CMS works and how one should be building the website on WordPress.
This article is WordPress Theme Development Tutorial, where the website design and CSS and all the functional and cosmetic changes are gathered in a single theme using a step by step process. The article will start from the introduction of the themes till the development of the theme in few basic steps.
Step 1: Know your basic languages
Step 2: Build a list of essential resources
Step 3:Choose the Area of Development You’ll Focus On
Step 4:Fork or adopt a WordPress theme or plugin
Step 5: Create your own theme or plugin
Step 6: Get involved in WordPress core
WordPress Themes reside in the subdirectories of WordPress Theme Folder. i.e. wp-content/themes/. The directory has all the necessary files like style sheet(CSS), template files, functions file and JS files along with the images.
The WordPress theme should at least have two files mentioned as follows:
Both the files mentioned above go into the Theme directory. The index.php template file can be used to include plenty of references to the header, sidebar, footer, content, categories, archives, search, error, and any other page created in WordPress, to make it easier and better for anyone to understand how to use the same.
WordPress has articulated the complete guide to use WordPress as part of the documentation which is very useful for developers and designers. You can find the documentation at WordPress Codex and for dynamic content and functions one should take reference from Functions Reference.
WordPress is one of the most easy to install, implement and user friendly content management system, initially developed for blogging and now a mature and highly scalable CMS making it a first choice for the users and WordPress Developers. Moreover WordPress has a large developers community, which adds and contributes to tons of features and plugins every day.
Step 1: Create subdirectory in ‘themes’ directory
Step 2: Create style.css file
Step 3: The Loop – Themain process
Step 4: Create Functions Files & Template Files
Let’s have a look on the WordPress Theme Development basics step by step:
You can see basic WordPress theme structure calling files in the image given below:
To create a theme and get it recognized as theme in WordPress installation, you must create a subdirectory in ‘themes’ directory with a unique name without spaces, however hyphens are allowed. It should be in lowercase letters. For example: techticfive
In step 2 create a style.css file which is must to define a theme in WordPress, code should be as below:
/* Theme Name: Techtic Five Theme URI: http://wordpress.org/themes/techticfive Author: Techtic Team Author URI: https://www.techtic.com/wp Description: Basic theme with all required functions for starters Version: 1.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: basic, starter, techticfive Text Domain: techticfive This theme, like WordPress, is licensed under the GPL. Use it to make something cool, have fun, and share what you've learned with others. */
In addition to CSS style information for your theme, style.css provides details about the Theme in the form of comments. No two Themes are allowed to have the same details listed in their comment headers. The comment header lines in style.css are required for WordPress to be able to identify the Theme and display it in the Administration under Design > Themes as an available Theme option along with any other installed Themes.
In the image above review the default templates used to convert a simple html file to WordPress page. WordPress has very good concept of fallback support, which is shown below. It shows how the templates hierarchy is formed to avoid site crash or looking ugly and how you can run site easily with minimal files / templates.
You can see the ‘fallback’ system for templates above. All the template types and files fall back to index.php, which is the default for WordPress if that template is not present.
“The Loop” is the main process of WordPress. The Loop is used in template files to show the posts to the visitors of the website. Question is: Can we create a theme without The Loop? Yes but you can not display data from one post.
The Loop goes into action only when the default settings are collected from the database, which includes, number of posts, commenting is enabled and more. Once the verification is done then The Loop will start its action.
The following is a functional index file (index.php), which displays the contents (and only the contents) of each post, according to the conditions used to prepare The Loop. This example demonstrates how little is actually necessary for the functioning of The Loop. See loop in action in below:
<?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; get_sidebar(); get_footer(); ?>
A theme can optionally use a functions file, which resides in the theme subdirectory and suggested uses for this file are:
Templates are PHP source files used to generate the pages requested by visitors, and are output as HTML. Template files are made up of HTML, PHP, and WordPress Template Tags.
Here is the list of the Theme files recognized by WordPress. Of course, your Theme can contain any other style sheet, images, or files. It is inevitable to that the following have special meaning to WordPress:
Quite comprehensive, right? We hope we didn’t get too technical on this. For those of you who feel confident about developing your own WordPress themes, go ahead and get your creativity flowing. But if you feel this is daunting and would benefit if there were an expert taking care of this, we recommend getting in touch with us.
Read More: Building WordPress Plugin Development
Get in touch with us today for a discussion.
Today this is the world of digital presence. In order to expand a particular business or a brand, the company needs to be in the digital world.
Please share your contact information, for us to connect with you and offer you a free discovery session about your digital product.