Customizing WordPress themes starts with understanding the building blocks of the WordPress theme. If you’re new at customizing themes we highly suggest using child themes. Click here to read about WordPress child themes and how to use them.
In case you haven’t read our WordPress child themes article yet, WordPress child themes are separate themes that rely on a parent theme for most of their functionality. If you are using a child theme, WordPress will first check your child theme to see if a specific functionality already exists. WordPress will look for functionality in the template files as listed below in Basic Template Files. If it theme/template override doesn’t exist in the child theme, it will use the parent theme. This allows you to only add things you wish to change to your WordPress child theme and lets the parent theme handle the bulk of the functionality. This makes theme overrides easy and troubleshooting of any odd behavior as a result of a change much easier to track down.
Basic WordPress Theme Building Blocks
Basic Template Files | |
---|---|
style.css | Style sheet file |
index.php | Home Page file |
single.php | Single post page file |
archive.php | Archive or Category file |
searchform.php | Search form file |
search.php | Search content file |
404.php | Error page file |
comments.php | Comments template file |
footer.php | Footer content file |
header.php | Header content file |
sidebar.php | Sidebar content file |
page.php | Single page file |
PHP Header Snippets | |
---|---|
bloginfo('name'); | Title of the site |
wp_title(); | Title of the specific post or page |
get_stylesheet_directory_uri(); | The style.css file’s location |
bloginfo('pingback_url'); | Pingback URL for this site |
bloginfo('template_url'); | Location for the site’s theme files |
bloginfo('version'); | WordPress version for the site |
bloginfo('atom_url'); | Atom URL for the site |
bloginfo('rss2_url'); | RSS2 URL for the site |
get_site_url(); | Exact URL for the site |
bloginfo('name'); | Name of the site |
bloginfo('html_type'); | HTML version of the site |
bloginfo('charset'); | Charset parameter of the site |