custom-theme

How to Create Custom Theme in WordPress

Spread the love

Today we are learn how to Create Custom Theme in WordPress.

Before creating custom theme in WordPress, you should have some basic knowledge of WordPress, if you do not have basic knowledge of WordPress then you cannot create WordPress custom theme.
So first of all you should know how to install WordPress and how to setup it. Don’t worry if you don’t know WordPress.
How to setup and install I have already blog on this, read it and then follow next step.

How to Install WordPress?

Here are some steps to create WordPress custom theme, if you follow it then you too can create your own theme in WordPress.

Basic Information Guide

First of all, we will see what is the basic structure for creating WordPress Custom Theme.

Create a new folder by going to the folder in which the WordPress website is setup, going to the folderc htdocs/wordpress/wp-content/themes the folder is named mytheme.

Now create the Necessary files for your Custom Theme

this is basic setup in WordPress theme.

Style.css

First create style.css file. and opening it in any editor, give theme name, desktop and author parameters
Here I am just learning to make normal custom theme so I will just give 3 parameters which are given below code:

/*
Theme Name: Mytheme
Theme URI: https://myproograming.com/
Author: Myprograming
Author URI: https://myproograming.com
Description: This is my first custom theme!
Version: 1.0.0
*/

index.php

You have to create index.php file otherwise template error will occur.
Even if you keep it empty, it will work but an index file will have to be created.

screenshot.png

Screenshot.png is the image we see in the backend of WordPress, which tells us about the theme design.

Even if you do this, your custom theme will start showing.

functions.php

Functions.php isn’t strictly a required file, but it offers so many benefits that 99.99% of themes have it. In functions.php you can use the built-in theme functionality of WordPress and also add your own custom PHP code.

Now create functions.php in your theme folder.

page.php

header.php

Functions.php isn’t strictly a required file, but it offers so many benefits that 99.99% of themes have it. In functions.php you can use the built-in theme functionality of WordPress and also add your own custom PHP code.

Now create functions.php in your theme folder.

All you need to know about files to create a custom theme in WordPress. Which is mentioned in the short details below

Template Files List

style.css

The main stylesheet. This must be included with your Theme, and it must contain the information title for your Theme.

rtl.css

The rtl stylesheet. This will be included automatically if the website’s textbook direction is right-to- left. This can be generated using the RTLer plugin.

index.php

The Main template. However, indicator, If your Theme provides its owntemplates.php must be present.

comments.php

Comment template.

front page.php

Front page template.

home.php

This is Home page template, which is the front page by default. If you use a static front page this is the template for the page with the latest posts.

single.php

The single post template. Used when a single post is queried. For this and all other query templates, index.php is used if the query template isn’t present.

single-{post-type}.php

The single post template used when a single post from a custom post type is queried. For illustration single-news.php would be used for displaying single posts from the custom post type named “news” index.php is used if the query template for the custom post type isn’t present.

page.php

This Is a page template. Used when asking about a single page.

category.php

This is a Category Template. Used when asked about a category.

tags.php

This is a Tag Template. Used when asking about a tag.

taxonomy.php

This is a term template. In custom taxonomy a term is used when asked.

author.php

This is a author template. It is used when questioning an author.

date.php

Date/Time Template. Used when asked for a date or time. Year, Month, Day, Hour, Minute, Second.

archive.php

The Archive template. Used when a order, author, or date is queried. Note that this template will be hoofed by category.php, author.php, anddate.php for their separate query types.

search.php

This is a Search result template. Used when searching.

attachment.php

Attachment Template. Used when viewing a single attachment.

image.php

Image attachment template. Used when viewing a single image attachment, However, attachment, If not present.php will be used.

404.php

The 404 Not Plant template. Used when WordPress can not find a post or runner that matches the query.


Spread the love

Related Posts

One thought on “How to Create Custom Theme in WordPress

Leave a Reply

Your email address will not be published.