WordPress Theming

Ryan Hoover
Dad, Husband,
Developer, Marketing @ WP Engine,
@rhetorryan

We’ll talk about

What is a theme?

It’s the “skin” for your website.
Themes control

What isn’t a theme?

Themes should control appearance.

Plugins should control functionality.

But there’s a large gray zone.

Ex: Do I put a custom post type in a theme or plugin?

How do themes work?

What (technically) is a theme?

A theme can be just two files:

Almost always, a theme is dozens of files to handle special cases

Theme declaration in style.css
Theme declaration in style.css

Let’s look at a theme!

We’ll take a quick tour of Twenty Seventeen.

This is the latest of the official Twenty themes. It’s a great place to start.

(All Twenty themes are built to be simple and straightforward)

The Loop

A really simple loop

You can use lots of Template Tags to add in post content

Child Themes? Why does my theme need to reproduce?

What are child themes?

How do I make a child theme?

Can I boss around my parent?

Sure! Child themes are very independent.

PHP kids are bossy

Create a file with the same name as your parent, and your file takes precedence.

CSS and JS kids are lonely

You have to ask for your parent’s CSS and JS files to load.

Can I just override a small part?

Maybe. There are 3 ways you could do that.

get_template_part ( ‘components/post’,  ‘format’ )

Lets you write small files to display specific parts of the page

add_action ( ‘wp_head’, ‘do_my_tracking_script’ )

Lets you do extra pieces of code at certain points of the page load

add_filter ( ‘the_content’, ‘change_the_post’ )

Lets you change content before it’s displayed

Where do I find good themes?

Hmm. Find a good theme?

WordPress.org

Jetpack + WordPress.com

Genesis or Underscores

What WordPress Theme Is That?

Themeforest

Hundreds of other sites

Questions? Thoughts?