The Anatomy Of A WordPress Site
Established in 2003 WordPress is a free open-source blogging platform written in PHP based on plug-in architecture and template system.
WordPress has gained popularity as a result of its ease of use. Search engines work well with WordPress because it’s formatted for easy indexing. WordPress allows each post, image and page to have its own title, description and meta-tag keyword.
This article will review key elements that work behind the scene to make a blog page possible.
WordPress Theme Components
The top section of a WordPress page is called the header. The header is controlled by the header.php file. This is a global file that manages headers on each page. It is coded with a combination of HTML and PHP.
Display elements of the main area of each page is called the loop. The loop is handled by multiple template files that contain template tags. By default the loop displays title, time and categories. Loop template files are primarily coded in PHP but can contain HTML code.
Listen to the Latest Episodes Right Now.
Sidebars are controlled by the sidebar.php file. To have multiple sidebars on a page the functions.php file requires editing.
Footers are controlled by the global file footer.php coded in PHP and HTML. This template file is configurable to display different content on each page.
The home page is controlled by the default index.php template file. It contains a default loop that queries the blog output with a link that controls navigation between posts. The default index.php file can be replaced with a custom home page. This is accomplished by configuring the page/URL option in wp-admin>settings>read.
Individual posts are controlled by loop queries contained in single.php. This file also defines whether or not sidebars are displayed for each post.
The appearance of a WordPress blog page is managed by the page.php template. This file provides the ability to manage sidebars and other elements on a page. By copying, pasting and renaming page.php additional WordPress pages can be added to a site.
WordPress archive pages provide a simple way to bring together old content in one place. WordPress uses a hierarchy system to determine which template is used. If an archive.php file does not exist then index.php is used by default. Archive.php can be overwritten by category.php and category templates can be overwritten by tag.php
WordPress requires modifiable background files to exist in the theme’s folder for themes to work. These files include; comments.php, functions.php and style.css.
Comments.php controls how comments are displayed and can be added to a loop to display comments in the theme. Plug-ins can override comments.php by using Disqus which is a comment system of social media APIs. It allows users to connect to the WordPress site through social media accounts.
The functions.php file operates like a plugin managing functionality and features of a WordPress site. It can be used to call and define custom functions with custom PHP code. It can manage the amount of characters in an entry.
Style.css is used to manage and modify the design of a site. The style sheet has text at the top to name the theme, author and URL.
WordPress provides the option to further customize a site using plugins, custom fields and widgets.
Plugins provide an easy way to expand the functionality of a WordPress site. Developers can create and deploy plugins which include e-commerce, social media, slide-show functionality and calenders.
Custom fields allow a developer to add information known as meta-data. Meta-data is configurable with arbitrary information which can be a posts expiration date, or categories like “currently reading”, “mood” or “weather”.
Widgets enable sidebars to be updated with configurable content in the form of modules. Management of widgets occur in wp-admin files. Widgets can include search forms, video or images.
WordPress allows customization of the layout and functionality of a page with template files. It makes it easy for non-developers to build and administer a fully integrated website.