TEMPLATES

Templates work in tandem with the database and PHP to render HTML files at runtime. As explained in the themes video (from the prior section), templates get merged with content from the database in a fraction of a second, and are a convenient way to organize layout and style in a generic way, without having to write code to display every page in your site.

Below, we provide an overview of the most common WordPress templates, written by Himanshu Sharma, and found here: https://www.optimizesmart.com/wordpress-ninja-15-minutes/. Each of these templates can be edited by going to your WordPress Admin Panel >> Appearance >> Editor, and then selecting the template of interest from the right-hand panel.

header.php

This file display headers and navigation. If you want to make changes to the head section(… of each web page (like adding the Google Analytics Tracking Code or other tracking code etc) then you need to edit this file.

index.php

This template file is used to display the blog post index. The blog post index contains a loop (bunch of PHP code) which displays the most recent blog posts according to some predefined conditions. It displays a list of posts in excerpt or full-length form. The blog post index can be set to display on the front page of your website or on a separate static page.

home.php

This template file can also be used to display the blog post index. The blog post index can be set to display on the front page of your website or on a separate static page. If this file is missing then wordpress looks for a file called index.php in the active theme’s directory & uses that template to display the blog post index.

front-page.php

This template file displays your website’s front Page (which is usually called the home page). The front page can be a static page or a blog posts index. WordPress searches for this file first when you load the front page of your wordpress website. If this file is missing then wordpress looks for a file called home.php. If home.php is also missing then wordpress looks for a file called index.php and uses that template to display the front page of your website.

page.php

This template file displays page title and its contents. If you are a logged in user with ‘edit’ permission than this file displays the ‘Edit’ link through which you can edit the contents of a page. It also display comment list and comment form.

single.php

The template file displays:

  • blog post’s title
  • blog post’s content
  • author name
  • date of the post
  • post category & tags
  • comment list
  • comment form
  • Navigation links to the previous and next posts.

category.php

This template file controls how category pages should be displayed. You can edit the file by going to your WordPress Admin Panel > Appearance > Editor > category.php

author.php

This template file controls how an author page should be displayed. You can edit the file by going to your WordPress Admin Panel > Appearance > Editor > author.php

search.php

This template file controls how a search result page should be displayed .

404.php

This template file is used when wordpress cannot find the post or page which is queried.

footer.php

Edit this file to change the footer of each web page on your site. Many times this section is used for including additional JavaScript files or for Google Analytics.

comments.php

This template file decides how the comments should be displayed.

style.css

This is the main style sheet file of your wordpress theme and is used to control the design and layout of your web pages. You can also edit this file to change the theme name, author name or author URL.

sidebar.php

This template file is used to control the sidebar display. You can set up the contents of the sidebar widgets through the WordPress admin panel.

functions.php

This file is used to add your own custom features to your theme. It works like a plug-in file. Since this file is theme specific, you lose the custom functionality once you change your theme. Not all wordpress themes use this file.

results matching ""

    No results matching ""