Required File For A WordPress Theme

Hello Guys Welcome To Our New Episode. 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 wordpress
Required File For WordPress

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.

require file for wordpress theme development
theme details

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.

Please follow and like us:

293 thoughts on “Required File For A WordPress Theme”

  1. Do you mind if I quote a few of your posts as long as I provide credit and sources
    back to your site? My website is in the exact same
    area of interest as yours and my visitors would truly benefit from some of the information you present here.
    Please let me know if this okay with you. Regards!

  2. Write more, thats all I have to say. Literally, it seems as though you relied on the video
    to make your point. You obviously know what youre talking about, why
    waste your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?

  3. An outstanding share! I’ve just forwarded this onto a coworker who
    was doing a little homework on this. And he in fact bought
    me breakfast because I discovered it for him… lol. So let me reword this….
    Thanks for the meal!! But yeah, thanks for spending the time to talk about this
    issue here on your website.

  4. Hey there this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding skills so I wanted to get advice from someone with experience. Any help would be greatly appreciated!|

  5. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something informative to read?|

  6. Very good website you have here but I was curious about if you knew of any message boards that cover the same topics discussed here?

    I’d really like to be a part of group where I can get feedback from other
    knowledgeable people that share the same interest. If you have
    any suggestions, please let me know. Cheers!

  7. Hey! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no backup. Do you have any methods to protect against hackers?|

  8. Good day! I could have sworn I’ve been to your blog before but after browsing through some of the articles I realized it’s new to me. Anyhow, I’m certainly pleased I discovered it and I’ll be book-marking it and checking back often!|

  9. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment. Is there any way you can remove me from that service? Many thanks!|

  10. I don’t even know how I ended up here, but I thought this post was great. I do not know who you are but definitely you are going to a famous blogger if you aren’t already 😉 Cheers!|