Required File For WordPress Theme – A Complete Guideline

Hello Guys Welcome To Our New Episode. Its time to learn Required File For WordPress Theme. Now Its Time To Go In Deep. Lets Start The Series For WordPress Theme Development. Before Going In Deep If You Don’t Know What Is WordPress Click On Here. Or You Can Check How To Install WordPress Locally. Now Its Time To Know Before Starting WordPress Theme Development Which File Are Required?

There are only two files absolutely required in a WordPress theme:

  1. index.php – the main template file
  2. style.css – the main style file

Hope You Guys Know Where Is Theme Folder? If You Don’t Know Where It Is Then Knock Me. I will Help You Guys To Recognize It. So Beside The Default Theme Folder Like twentysixteen, twentyseventeen, twentynineteen, twentytwenty Create Your Theme Folder And Inside Your Theme Folder Create Those Two Required File. And Access The Address Where You Have Install Your WordPress. If You Go On Appearance >> Themes Then You Will See Like Below. I Just Create Those Two File index.php And style.css With The Folder Name customtheme. After That The Output Is In Front Of Us. But That Is Not a Proper Thing For Creating A WordPress Theme. As We See In Twenty Twenty WordPress Theme There Is A Thumbnail Image. And If We Click On Theme Details Of Twenty Twenty WordPress Theme We Will See Information About The Theme So We Need That Also In Our Theme.

Required File For A WordPress Theme

So In First Step We Try To Bring The Thumbnail Image. Its Super Easy. Bring Your Image That You Want To Show And Set The Name screenshot.png. The Standard Size For The Image Is 1200*900. After Give The Image There Your Preview Image Will Come Like A Magic. That’s The Power Of WordPress. After That We Need To Show The Data For The Theme Like The Other Theme Have. For That We Need To Write Some Code In Our style.css File. So lets Write The Code And Do Some Magic. Inside style.css Write The Damn Cool Code What I set Below.

/*
Theme Name: Custom Theme
Theme URI: http://themehat.com/demo/customtheme/
Text Domain: customtheme
Description: Custom Theme Is A Theme For Only Developing Purpose. Set The Description That You Want to Set
Version: 1.0
Author: Themehat
Author URI: https://themehat.com
Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

After Write The Code Save The Code And Just Click On The Theme Details. You Will See It Like The Image.

Required File For A WordPress Theme

Isn’t It Cool. I Hope You Guys Are Enjoying. In The index.php file you Need To Write The Code That User Will See. We Will Discuss That On later. Lets See What Are The Other File We Need To Make A WordPress Theme. I am Giving A List Of The File Directory.

Common WordPress template files

Below is a list of some basic theme templates and files recognized by WordPress.

index.php : The main template file. It is required in all themes.

style.css : The main stylesheet. It is required in all themes and contains the information header for your theme.

rtl.css : The right-to-left stylesheet is included automatically if the website language’s text direction is right-to-left.

comments.php : The comments template.

front-page.php : The front page template is always used as the site front page if it exists, regardless of what settings on Admin > Settings > Reading.

home.php : The home page template is the front page by default. If you do not set WordPress to use a static front page, this template is used to show latest posts.

header.php : The header template file usually contains your site’s document type, meta information, links to stylesheets and scripts, and other data.

singular.php : The singular template is used for posts when single.php is not found, or for pages when page.php are not found. If singular.php is not found, index.php is used.

single.php : The single post template is used when a visitor requests a single post.

single-{post-type}.php : The single post template used when a visitor requests a single post from a custom post type. For example, single-book.php would be used for displaying single posts from a custom post type named book. The index.php is used if a specific query template for the custom post type is not present.

archive-{post-type}.php : The archive post type template is used when visitors request a custom post type archive. For example, archive-books.php would be used for displaying an archive of posts from the custom post type named books. The archive.php template file is used if the archive-{post-type}.php is not present.

page.php : The page template is used when visitors request individual pages, which are a built-in template.

page-{slug}.php : The page slug template is used when visitors request a specific page, for example one with the “about” slug (page-about.php).

category.php : The category template is used when visitors request posts by category.

tag.php : The tag template is used when visitors request posts by tag.

taxonomy.php : The taxonomy term template is used when a visitor requests a term in a custom taxonomy.

author.php : The author page template is used whenever a visitor loads an author page.

date.php : The date/time template is used when posts are requested by date or time. For example, the pages generated with these slugs:
http://example.com/blog/2014/
http://example.com/blog/2014/05/
http://example.com/blog/2014/05/26/

archive.php : The archive template is used when visitors request posts by category, author, or date. Note: this template will be overridden if more specific templates are present like category.phpauthor.php, and date.php.

search.php : The search results template is used to display a visitor’s search results.

attachment.php : The attachment template is used when viewing a single attachment like an image, pdf, or other media file.

image.php : The image attachment template is a more specific version of attachment.php and is used when viewing a single image attachment. If not present, WordPress will use attachment.php instead.

404.php : The 404 template is used when WordPress cannot find a post, page, or other content that matches the visitor’s request.

More on WordPress Theme Development

WordPress.org offers an a great, in-depth resource in their Theme Development Handbook. The WordPress Developer Course also covers WordPress theme development in more detail, including WordPress hooks an filters, working with the WordPress loop and more.

Hey Its A Short Description For The Every File. I will Break All The File And Describe It Briefly. With These File We Can Make A Simple WordPress Theme. In The Next Episode I Will Break Two Or Three File To Make You Guys Understand How These File Works? So Good Bye For Today. Hope You Guys Enjoyed It.

Shopping Cart