2. Who am i?
● Owner of QC Creative, a local digital
marketing and web development agency
● Web developer for over 10 years
● Since 2010, 90% of projects have been in
WordPress
● @joshleecreates
4. PHP Basics
PHP allows logic
operations with
variables:
$x = 1;
$y = 2;
$z = $x + $y;
And with functions:
echo( ‘Hello, World’ );
$post_title
= get_post_title();
5. PHP Basics
Conditionals:
$x = true;
if( $x == true ) {
echo( ‘x is true’);
}
x is true
Loops:
$x = 0;
while( $x <= 10 ) {
echo( ‘x is: ‘ . $x
);
}
x is: 0
x is: 1
x is: 2
...
6. Template Tags
Template tags allow you to use a small PHP
snippet to inject values from your WordPress
database into a page
the_title();
the_content();
the_excerpt();
the_post_thumbnail();
7. Output or retrieve data
`the_` tags output
content directly into
the page:
<h1>
<?php the_title(); ?>
</h1>
`get_` tags retrieve
values which can be
manipulated first:
<h1>
<?php
$title = get_the_title();
echo( $title );
?>
</h1>
9. The Template Hierarchy
WordPress determines what kind of view is
being requested, and combines the content
for that view with a specific template (PHP
file) from the theme.
The “Template Hierarchy” determines which
PHP template is used for which views.
11. Anatomy of a Request
How does WordPress build a page?
12. How does WordPress build a page?
1. User requests page
2. WP initialized
3. Plugins initialized
4. Theme initialized
5. Query type
identified
6. Template
identified
And finally…
The page is rendered
by processing the
chosen template
together with actions
and filters
13. “Theme Initialized” = functions.php
● functions.php is the first part of
the theme to get run
● It is always run after plugins are
initialized
14. Common Functions
● Enqueue scripts and styles
● Modify queries for specific pages
● Modify plugin or WP core behavior (actions)
● Modify plugin or WP core output (filters)
● Declare theme support
● Include other PHP libraries
16. What is theme support?
● add_theme_support()
● Tells WP which features your theme can
support
● E.g.: featured images, HTML5 markup, etc.
● http://codex.wordpress.org/Function_Refe
rence/add_theme_support
18. What are Hooks?
A hook is an anchor associated with a specific
event within WordPress
E.g.:
● A page is requested
● A query is run
● the_content() is output for a post or page
● A user logs in
19. What are actions? Filters?
Actions & Filters are functions that you
define, and attach to a specific hook.
20. Which means…
We can tell WordPress:
● Whenever doing X, first do Y
● E.g.:
o Whenever loading the blog homepage, first add my
custom post type to the query