According to WordPress.com, 31% of the total Internet Web site is created with WordPress CMS. Again, according to WordPress.org, the latest version of WordPress CMS is so far more than 130 million downloads. With this huge amount of downloads and usage, we understand how much work is done with WordPress. And downloading a WordPress does not mean becoming a complete website. Basically, a history starts with a download, and many more things like the theme customization, new theme development and plugin development, from the WordPress setup. In this episode, we will find out more about WordPress Theme. So let’s get started.
What is WordPress theme?
WordPress Theme is a collection of some files that work together with WordPress to display users’ content and display diversity. Each theme created for WordPress shows us different types of diversity and determines what the content of the site will look like in front of the user.
Basically, the themes show the variations of WordPress to the user. For example, you can convert WordPress CMS into a simple blog with a theme. At the same time, if you want, you can convert WordPress to a more popular website, including shopping sites, portfolio sites, magazine sites. Actually, WordPress themes combine designers with creators, developers, and general users.
What is the template in WordPress theme?
The files used in the entire theme of WordPress are called Template or Template File. And these files determine how your site is displayed. Template files are basically all PHP files which are HTML, template tag and PHP code. When you create your theme, then you will need to use different template layouts and template files to design your website. For example, you need to use the header.php template to create a header or use comments.php template file for adding the comment system to your website.
What can you do with WordPress Theme?
Once installed and activated in a theme, it can be customized in many ways. It seems that many new but complete themes give you all the options and benefits you need. For which you do not have to give any type of code in the theme code. Again some themes, such as starter templates and general themes where you may have to include many new options or benefits. So to customize things, you may need to work directly in template files. And you will have to decide how to display the content of your website.
Think of this as a real-estate theme, which may be a very common theme. There may be only a few files. Again a multipurpose theme that can contain more than one hundred files. For example, Twenty Seventeen WordPress theme is a complex theme with at least 70 files.
Again, WordPress-driven sites are dynamic, that is, content is stored in a database and content is displayed on front-end based on your template’s code. In other words, to access database contents, the theme gives you a user interface head.
With the theme, you can make WordPress’s admin panel and customization. Like login page, dashboard, toolbar, and footer etc.
In simple words, you can access all the functionality provided by WordPress. That means you can display all the features you have in WordPress, which you want to display through the theme. So, let’s see WordPress give us the functionality, the database stores our content, improves the plugin’s WordPress feature, and themes bring these things to a flexible template.
Another important thing is that the themes keep the user interface different from WordPress’s core files. As a result, you can take advantage of WordPress without any help in any core file. Thereby, updating WordPress core files will not change any of your themes. So millions of users are always connected with WordPress’s most up-to-date updates.
Where are the themes of WordPress?
And you’ll have to activate the Theme by going into the Appearance → Themes of your WordPress admin panel.
What is template file in WordPress theme?
There are many types of Template files in WordPress themes. , But there are some similarities. Below is a list of
Original template file, it is mandatory for all themes.
The main stylesheet file, it is compulsory for all themes, apart from the design of your theme, there are many more information about Theme’s header information such as, Theme name, author name, theme version, date and description.
If the content of the website is required to display right to left, then it is used.
It can be used for the layout section of the comment section of the website.
The website is used for FrontPage if it exists, and it needs to be set to Admin> Settings> Reading.
The homepage is WordPress’s default front page. If you do not set any static front page as a home page, then it will display the latest posts by default.
When WordPress gets the single.php file or page.php file, a single template is used. And if the singular.php file is not available then the index.php file is used.
Single post template is used when a visitor requests for single post.
When the Visitor requests a single post from a custom post type. For example, single-book.php template file will be used for single post when there will be no custom template file in the named book.
The Archive Post Type template is used when the visitor requests a custom post type archive. For example, archive-book.php template file will be used to show archive posts when a custom post is called for books. The archive.php template file will be used when there is no archive-post-type.php template file.
The page template file is used when the visitor requests an individual page. Which is the built-in template?
Whenever a visitor requests a specific page such as “about” then the slug page template will display a specific page template in contrast to the pages requested. Such as page / about.php file instead of/about page
When the Visitor requests a post on the basis of category, then a category template is used.
When the visitor requests a post based on the tag, the category template is used.
When a visitor requests a post based on a custom taxonomy term, the taxonomy template is used.
When the visitor loads an author page, then the author page template is used.
When the visitor requests a post by date, the date/time template is used. Then pages generate the following slugs
When the visitor requests a post by category, author or date, the archive template is used. Note: This template is used instead of the currently used template file such as- category.php, author.php and date.php file.
The search result template is used to show the visitor’s search result.
Attachment template is used to display the attachment file, such as image, pdf or other media file to the visitor.
Image attachment template is used to show the attachment file to the visitor like the image. If the image attachment file is not present then only the attachement.php file is shown.
404 template is used when WordPress is not found in any post.
What is template tags in WordPress?
Template tags in WordPress are some PHP Function which, is used to dynamically accept and display various information within WordPress’s theme. WordPress theme developers are using Template tags for accepting and displaying dynamic information in the theme’s template files. There are numerous built-in template tags for WordPress’s theme use. WordPress themes and plugins are also used to create and use their own template tags.
<?php the_author(); ?>
Author template tag this is basically, used to display the author’s name on the WordPress post.
Such as, <p>This post is written by <?php the_author(); ?></p>
The template tags used in the template files of the wordpress theme are as follows-
get_header () – Themer index is used to include header.php file.
get_sidebar () – The theme index is used to include the sidebar.php file.
get_footer () – Used to include footer.php file at Theme index.
There are also numerous other template tags that we will discuss later in different chapters.
What is the difference between WordPress theme development and theme customization?
WordPress’s Theme Development is meant to create a new WordPress theme. Where template files in the theme will be completely new based on the new or old concept. And the theme Customization is mean to change the design of its template files and to add a new feature, keeping the features of existing or old themes unchanged.
How to show the WordPress theme pages?
The pages in the theme are based on the Template Hierarchy and the current page-view. Find WordPress theme specific template in each page. If you do not get a specific template, then look for the less specific template to do the WordPress work.
For example, when a person visits the date-archive page, WordPress checks the following template files and themes for their use and searching.
DATE.PHP → ARCHIVE.PHP → INDEX.PHP
Likewise, if a single page is requested, such as About Page, WordPress first checks the theme for any Custom Page template. If no custom templates are available then WordPress will check the default page template page.php. If not found, WordPress will then check the archive template. And if all is deleted then by using index.php of default theme template to create WordPress page.