Add Custom Header Support to your WordPress Themes To enable Custom Headers in your wordpress themes, add the following to your functions.php file: When enabling Custom Headers, you can configure several other options by passing along arguments to the add_theme_support() function. You can pass specific configuration options to the add_theme_support function using an array: In the above case, the default array values are assigned to a variable called $defaults. Set a custom header image When the user first installs your theme,...
Page templates are a specific type of template file that can be applied to a specific page or groups of pages. Since a page template is a specific type of template file, here are some distinguishing features of page templates: Page templates only apply to pages, not to any other content type (like posts and custom post types). Page templates are used to change the look and feel of a page. A page template can be applied to a single page,...
This article explains how WordPress Themes determines which template file(s) to use on individual pages. If you want to customize an existing WordPress theme it will help you decide which template file needs to be edited. The Template File Hierarchy Overview WordPress Themes uses the query string to decide which template or set of templates should be used to display the page. The query string is information that is contained in the link to each part of your website....
Why We Need the Archive Page In WordPress Themes, you get to work with a range of different page templates and structures in the standard configuration. Looking at the directory listing of the default theme at the time of writing, Twenty Fifteen, we find the following: 404 error page, archive page image attachments page, index page (the main page), default page template (for pages), search results page, single post and attachment pages. Despite their different purposes, all of these pages are...
All in one word, hooks are built into WordPress or wordpress themes and are used to modify or add functionality to the core system without modifying core WordPress files at all. The Requirement of Hooks Let’s assume for a moment that WordPress does not provide any hooks. And let’s also say you work with a lot of scheduled posts and you would like to email yourself when a post is published. How would you go about doing that? Without hooks you...
A plugin is a safe way to try out new things and the way to go if you need to implement cross-theme functions. This article will walk you through creating a simple plugin to have a look at some basic concepts about wordpress themes plugin. A Simple Plugin Project In this article we’re going to create a plugin that integrates WordPress and Facebook Open Graph. Open Graph tags are special HTML tags, which give Facebook the information it needs to share your page and...
Creating shortcodes for use in wordpress themes is fairly straightforward. Shortcodes are written by providing a handler function. Shortcode handlers are broadly similar to WordPress filters: they accept parameters (attributes) and return a result (the shortcode output). Shortcode names should be all lowercase and use all letters, but numbers and underscores should work fine too. Be wary of using hyphens (dashes), you’ll be better off not using them. The add_shortcode function is used to register a shortcode handler. It...
By default, the WordPress header is a simple piece of code. You do not have to get into the code to change the header that comes with whatever WordPress Theme you choose. You set the blog or website title and description in the Administration > Settings > General panel, and WordPress does the rest. In its simplest form, the WordPress Classic Theme features the header code like this in the wp-content/themes/classic/header.php template file: The header is set in an...
What Is A Page Template? A page template gives you the ability to deviate from your site’s existing structure in addition to adding new features. Twenty Fourteen includes two great examples: a contributor page and a fullwidth page. The contributor page introduces new functionality: the ability to list the authors who have contributed to your website. The full width template alters the structure of the page by removing the sidebar, focusing more on content. Twenty Eleven also provides two page...