11
Anatomy of a WordPress Theme Pittsburgh WordPress Anonymous Group

Anatomy of a WordPress Theme

Embed Size (px)

Citation preview

Page 1: Anatomy of a WordPress Theme

Anatomy of a WordPress Theme

Pittsburgh WordPress Anonymous Group

Page 2: Anatomy of a WordPress Theme

Objective In this module you’ll learn about the different

files that make up a theme and how they work together to display your website.

Page 3: Anatomy of a WordPress Theme

Prerequisites Basic knowledge of installing and activating

WordPress themes Basic knowledge of HTML, CSS, and PHP

Page 4: Anatomy of a WordPress Theme

So… Are you familiar with installing and activating

themes via the WordPress Dashboard? Will you have a locally or remotely hosted

sandbox WordPress site to use during class? Do you have a text editor to view PHP, HTML,

CSS, and other files?

Page 5: Anatomy of a WordPress Theme

What is a theme? Design skin for WordPress website Controls the layout, colors, fonts, etc. for the

WordPress site Built on “blocks” or chunks of code for

different areas of the site Common setup is header.php, index.php,

sidebar.php, and footer.php

Page 6: Anatomy of a WordPress Theme
Page 7: Anatomy of a WordPress Theme

Sample index.php[php]<?phpget_header();get_sidebar();if ( have_posts() ) : while ( have_posts() ) : the_post();the_content();endwhile;endif;get_footer(); ?>[/php]

Page 8: Anatomy of a WordPress Theme

What’s in a theme?

Index.php Style.css Header.php Footer.php Sidebar.php Functions.php Screenshot.png

Single.php Page.php Archive.php Category.php Tag.php Comments.php 404.php Search.php Front-page.php

Page 9: Anatomy of a WordPress Theme

Other files in themes /css/ /js/ /img/ /language/

Page 10: Anatomy of a WordPress Theme

Template Heirarchy

WP will always look for post type template first – page.php, single.php. If none, fallback is index.php

For archives – category, tag, all posts, etc., WP looks for specific template firstcategory-tutorial.php, tag-dogs.phpthen basic archive template – category.php or tag.php, and falls back to archive.php

wpheirarchy.com

Page 11: Anatomy of a WordPress Theme

What is a Child Theme? Child themes us all files from parent theme except those files contained in the child theme folder.