What You Don't Know You Can Do

WordPress Development for Absolutely Everyone

With Tracy Levesque / @liljimmi

Hi, I'm Tracy.

I am a Power User

I know HTML

I know CSS

I don't know PHP

There are many folks with skill sets similar to mine.

And we can develop for WordPress, too!

WordPress Development

Demystified!

I'm going to go through some terms being thrown around on that other track and explain what they are, what they can do, and how to use them.

The WordPress Template Hierarchy

The WordPress Template Hierarchy

codex.wordpress.org says:

WordPress uses the Query String — information contained within each link on your web site — to decide which template or set of templates will be used to display the page.

The WordPress Template Hierarchy

Translation

Templates are cool because if you name a template file a certain way, it will automatically apply to a certain page.

There's a chart on WordPress.org that shows how the naming conventions work.

OMG

The WordPress Template Hierarchy

What it is

The chart looks confusing, but it's really pretty simple.

The WordPress Template Hierarchy

What it is

Templates are the files in a theme that tell WordPress how to display your pages. They live in the theme's folder.

The WordPress Template Hierarchy

They're like different frames for your content

The WordPress Template Hierarchy

What it is

Templates handle the display of different pages on your WordPress site such as...

  • The main list of posts (the blog page)
  • A regular page
  • An archive page (Category, Tag, Author, Date pages)
  • A single post page
  • The search results page
  • Etc...

The WordPress Template Hierarchy

What it can do

If you name template files a certain way they will affect the display of those pages.

The WordPress Template Hierarchy

Twentytwelve example

The WordPress Template Hierarchy

How you can use it

Power users - Look for a theme or theme framework that allows you to add/modify templates.

Designers - Make them yourself! Just follow the chart.

The Loop

The Loop

codex.wordpress.org says:

The Loop is PHP code used by WordPress to display posts.

The Loop

Translation

The Loop is a set of instructions in a template that grabs content and displays it on a page.

It's called a "loop" because the set of instructions can be repeated multiple times on a page.

The Loop

The Loop is like making sandwiches.

The Loop

To make a sandwich you collect a set of ingredients and assemble it

The Loop

You repeat the steps of collecting and assembling as many times as needed

The Loop

What it is

Within The Loop are the main parts of a page or post. These are like the slices of bread in our sandwich.

  • Title
  • Content

The Loop

What it is

You can also grab additional content, aka Metadata, attached to pages or posts. These are like the ingredients in our sandwich.

  • Author
  • Date
  • Featured Image
  • Categories (posts only)
  • Tags (posts only)
  • Etc.

The Loop

What it is

In The Loop you can provide instructions that determine which posts are shown.

For example we could have the following instructions:

  • Only show posts from the "Pets" category
  • If a post is tagged "kittens" add a special style to it
  • If a post is tagged "dogs" don't show it

The Loop

What it can do

Custom loop example on the moviefanfare.com site.

The Loop

How you can use it

Power users - Look for a theme, theme framework or plugin that allows you to modify the display of the posts page.

Designers - Dig into the loop in your theme or child theme and start modifying! Check out The Loop in Action in the WordPress Codex.

Custom Post Types

Custom Post Types

codex.wordpress.org says:

A Custom Type is a Post Type you define.

Custom Post Types

Translation

Normally you only have 2 types of content to choose from: Pages and Posts. Guess what — you can make more!

Custom Post Types

What they are

Pages and Posts are both Post Types. They...

  • Are types of content with their own sets of fields
  • Have their own admin area in the WordPress admin
  • Let you add content in a repeating and consistent manner
  • Have a consistent layout (by default) on the front-end of your site.

Custom Post Types

What they are

So instead of just

You could have

Custom Post Types

Really, the possibilities are endless

Custom Post Types

What they can do

Custom Post Types can also have their own custom taxonomies. That just means they can have their own ways to group posts together.

Categories and Tags are taxonomies for Posts and Pages.

Custom Post Types

What they can do

If we created a custom post type called "Movies" some custom taxonomies we could use are

Genre, Year, Director and Rating

With these custom taxonomies you would have archive pages to see all movies by genre, year, etc.

Custom Post Types

Static Guard example

For mystaticguard.com we created 3 custom post types: Products, Stylists and Tips

Custom Post Types

Static Guard example

With Custom taxonomies, The Loop and the WordPress Template Hierarchy, the site is easy-to-manage.

Custom Post Types

How you can use them

Power users - Use a plugin that allows you to create Custom Post Types.

Designers - Code your own. Really! I have a how-to video on WordPress.tv that shows you how.

Hooks, Actions and Filters

Hooks, Actions and Filters

codex.wordpress.org says:

Hooks are provided by WordPress to allow your plugin to 'hook into' the rest of WordPress...There are two kinds of hooks:
  • Actions: A custom PHP function defined in your plugin (or theme) and hooked, i.e. set to respond, to specific events that take place in WordPress.
  • Filters: Functions that WordPress passes data through, at certain points in execution, just before taking some action with the data

Hooks, Actions and Filters

Translation

Hooks, Actions and Filters allow you to change WordPress functionality without breaking it.

Custom Post Types

What they are

Hooks - Points at which WordPress allows you to tap into a function and safely modify it.

Some examples are:

  • Changing the length of the excerpt
  • Changing the order of menu items in the admin
  • Adding content to the beginning or end of every post
  • Adding Custom Post Types
  • Adding Sidebars

Hooks, Actions and Filters

What they are

Actions - A hook that makes something new happen when a WordPress function is triggered.

Hooks, Actions and Filters

What they are

Filters - A hook that modifies a WordPress function when it is triggered.

Hooks, Actions and Filters

What they are

Now is when I do my awesome, visual illustration of Hooks, Actions and Filters using a volunteer from the audience.

Hooks, Actions and Filters

What they can do

Hooks, Actions and Filters are what makes WordPress great software for building an amazing site.

Hooks, Actions and Filters

How you can use them

Power users - If you've ever installed a plugin you are using them already.

Designers - Dig into the WordPress Codex article on Theme Development and start adding functionality to your themes.

Resources

THE END

Questions?

Slides available on Slideshare: slideshare.net/TheTracyL