Things you should know about WordPress (but were always too afraid to ask): WordCamp Raleigh 2014

Michael McNeill
Michael McNeillOwner at MRMcDEV, Inc.
THINGS YOU SHOULD KNOW 
ABOUT WORDPRESS 
(but were always afraid to ask) 
Power Users Track 
WordCamp Raleigh 2014 
Saturday, November 8th, 2014 
Michael McNeill - @michaelrmcneill #wcraleigh
ABOUT ME 
• Developer and Support Engineer in ITS Web Services at the University of 
North Carolina at Chapel Hill, where I help to manage two HUGE multisite 
networks that operate a total of almost 8,500+ sites. 
• Owner and Developer at MRMcDEV, Inc. my personal consulting company. 
• Co-Curator (Executive Director) of TEDxUNC, a non-profit organization 
dedicated to bringing “Ideas Worth Spreading” to Carolina. 
• I’ve been using WordPress for over 5 years now, and I use it for almost all my 
client projects. 
• I’ve worked on exciting and wide ranging projects, such as Black Enterprise 
Magazine, Mackay Communications, WiredHoods, smallbiztechnology.com, 
ALOHA, and MAXI Promotion and Records. I’ve also contracted for DRS 
Technologies, the United States Department of the Defense, and numerous 
other companies. 
@michaelrmcneill 
#wcraleigh
A QUICK ROADMAP… 
1. The WordPress APIs - What they are, how to find them, and 
how to use them. 
2. The WordPress Template Hierarchy - What it is, which file 
generates a certain type of page, and how to use it to your 
advantage. 
3. The WordPress Database - What is stored there, why it is 
stored there, how is it stored there, and how should you 
properly use the data inside it. 
4. A few “tricks of the trade” - Version Control and Vagrant 
@michaelrmcneill 
#wcraleigh
THE WORDPRESS CODEX 
@michaelrmcneill 
#wcraleigh
BOOKMARK IT! 
http://codex.wordpress.org 
@michaelrmcneill 
#wcraleigh
WHAT IS IT? 
The WordPress Manual written for all users, Designers and 
Developers alike. 
@michaelrmcneill 
#wcraleigh
USE IT & IMPROVE IT. 
When you first have a question, go to the Codex first. 
The Codex is a living document, and anyone with a WordPress.org account can 
edit it and improve it. If you see something out of date, or flat out wrong, update it. 
@michaelrmcneill 
#wcraleigh
THE WORDPRESS APIs 
@michaelrmcneill 
#wcraleigh
WHAT’S AN API? 
• APIs are Application Programming Interfaces. 
• Think about it like this, APIs are basically a contract 
between two things stating: "If you tell me this, I 
will do this.” 
@michaelrmcneill 
#wcraleigh
WHAT DO THE WORDPRESS 
APIs DO? 
• They help you do things using tools that 
WordPress gives you. 
• That makes development EASIER!! 
@michaelrmcneill 
#wcraleigh
HOW DO I FIND THEM? 
• Identify what you are trying to do. 
• Then go to the ___________ and search for it. 
• If that doesn’t work, try using Google, just 
remember to cross-check against what the Codex 
says. 
@michaelrmcneill 
#wcraleigh
HOW DO I USE THEM? 
• The format is basically the same across all function 
reference articles. 
• There are 3 primary sections. 
1. The description of the function. 
2. The parameters the function wants/needs. 
3. What values, if any, the function returns. 
@michaelrmcneill 
#wcraleigh
WORDPRESS PAGE LIFE CYCLE 
• The WordPress page life cycle is a combination of 
the events that take place from when a browser 
requests a page to when the server returns the 
rendered page to the browser. 
• That sounds simple, but there are a lot of things 
going on that get you the end result. 
@michaelrmcneill 
#wcraleigh
@michaelrmcneill 
#wcraleigh
WORDPRESS HOOKS 
• Hooks are extremely important to WordPress 
developers. 
• They enable us to literally hook into parts of the 
WordPress page life cycle to retrieve, insert, and 
modify data, and they allow us to take certain 
actions behind the scenes, before a user sees what 
is occurring. 
@michaelrmcneill 
#wcraleigh
WORDPRESS HOOKS 
@michaelrmcneill 
#wcraleigh 
• Two Classifications 
• Actions 
• Actions are triggered by specific events that take place in WordPress, 
such as publishing a post, activating a plugin, or loading an admin 
screen. 
• For a comprehensive list of actions, check this Codex article out: 
http://codex.wordpress.org/Plugin_API/Action_Reference 
• Filters 
• Filters are functions that WordPress passes data through, that are 
primarily responsible for intercepting, managing, and returning data, 
before rendering or saving that data. 
• For a pretty comprehensive list of filters, check this Codex article 
out: http://codex.wordpress.org/Plugin_API/Filter_Reference
WORDPRESS HOOKS 
• I’m sure you have the question, when should I use which 
hook? 
• Use actions when you want to add something to the 
existing page such as stylesheets, JavaScript, or send an 
email when an event has happened. 
• Use filters when you want to manipulate data coming out 
of the database prior to going to the browser, or coming 
from the browser prior to going into the database. 
@michaelrmcneill 
#wcraleigh
THE WORDPRESS PAGE 
TEMPLATE HIERARCHY 
@michaelrmcneill 
#wcraleigh
WHAT IS THE TEMPLATE 
HIERARCHY? 
WordPress templates fit together like the pieces of a 
puzzle to generate the pages on your WordPress site. 
Some templates (the header and footer templates 
for example) are used on almost all pages, while 
others are used only under specific conditions. The 
template hierarchy decides what template file or files 
WordPress will use to display a certain type of page. 
@michaelrmcneill 
#wcraleigh
@michaelrmcneill 
#wcraleigh
LET’S LOOK AT THE BASICS 
@michaelrmcneill 
#wcraleigh
THE NEEDS OF A THEME 
• To have a functioning, bare minimum theme you 
need two things. 
• style.css - A stylesheet. 
• index.php - An index file that will render the 
output of the page. 
@michaelrmcneill 
#wcraleigh
header.php 
@michaelrmcneill 
#wcraleigh
footer.php 
@michaelrmcneill 
#wcraleigh
single.php 
@michaelrmcneill 
#wcraleigh
sidebar.php 
@michaelrmcneill 
#wcraleigh
SINGLE POST RULES 
@michaelrmcneill 
#wcraleigh 
1. single-post.php 
2. single.php 
3. index.php
PAGE TEMPLATE RULES 
1. Custom Template defined in WP Admin 
2. page-<slug>.php 
3. page-<id>.php 
4. page.php 
5. index.php 
@michaelrmcneill 
#wcraleigh
HOME PAGE TEMPLATE RULES 
• front-page.php 
• Settings > Reading 
• Static Page 
1. Follows the page template rules. 
@michaelrmcneill 
#wcraleigh 
• Blog Page 
1. home.php 
2. index.php
SINGLE CUSTOM POST RULES 
1. single-<posttype>.php 
2. single.php 
3. index.php 
@michaelrmcneill 
#wcraleigh
CUSTOM POST TYPE RULES 
1. archive-<posttype>.php 
2. archive.php 
3. index.php 
@michaelrmcneill 
#wcraleigh
CATEGORY PAGES 
1. category-<slug>.php 
2. category-<id>.php 
3. category.php 
4. archive.php 
5. index.php 
@michaelrmcneill 
#wcraleigh
TAG PAGES 
@michaelrmcneill 
#wcraleigh 
1. tag-<slug>.php 
2. tag-<id>.php 
3. tag.php 
4. archive.php 
5. index.php
AUTHOR PAGES 
1. author-<nicename>.php 
2. author-<id>.php 
3. author.php 
4. archive.php 
5. index.php 
@michaelrmcneill 
#wcraleigh
ATTACHMENT RULES 
1. MIME-type.php (e.x. text.php, video.php, 
image.php) 
2. attachment.php 
3. single_attachment.php 
4. single.php 
5. index.php 
@michaelrmcneill 
#wcraleigh
CODEX ARTICLE 
http://codex.wordpress.org/Template_Hierarchy 
INTERACTIVE WEBSITE! 
http://wphierarchy.com/ 
@michaelrmcneill 
#wcraleigh
WORDPRESS DATA 
@michaelrmcneill 
#wcraleigh
WORDPRESS DATA 
• A WordPress website consists of three main 
elements: 
• The WordPress installation itself 
• The contents of the wp-content directory which 
includes the themes, plugins and uploads 
• The database, where all the content is stored. 
@michaelrmcneill 
#wcraleigh
TYPES OF WORDPRESS 
CONTENT 
@michaelrmcneill 
#wcraleigh 
• posts 
• pages 
• custom post types 
• attachments 
• links 
• menu items
ASSOCIATED DATA 
(POSTMETA) 
• categories 
• tags 
• custom taxonomies and terms 
• post metadata 
@michaelrmcneill 
#wcraleigh
OTHER TYPES OF CONTENT 
@michaelrmcneill 
#wcraleigh 
• widgets 
• options 
• users 
• sites (for multisite)
@michaelrmcneill 
#wcraleigh
A FEW NOTES… 
• In the next few slides, I’m using the wp_ prefix by 
default. You can change this (and you might have), 
but the concepts are the same. 
• A multisite installation will have some extra tables. 
I haven't included those here as that's outside the 
scope of this presentation. 
@michaelrmcneill 
#wcraleigh
THE WORDPRESS DATABASE 
STRUCTURE 
Most of the tables in the WordPress database are 
linked to one or more other tables via a specific field. 
This field is generally a unique ID for each record 
such as a post_id. 
@michaelrmcneill 
#wcraleigh
THE WORDPRESS DATABASE 
STRUCTURE 
TABLE DATA STORED LINKED TO 
wp_posts Posts, pages, attachments, 
revisions and menu items 
@michaelrmcneill 
#wcraleigh 
wp_postmeta 
(using post_id) 
wp_term_relationships 
(using post_id) 
wp_postmeta Post metadata wp_posts 
(using post_id)
THE WORDPRESS DATABASE 
STRUCTURE 
TABLE DATA STORED LINKED TO 
wp_comments Comments 
@michaelrmcneill 
#wcraleigh 
wp_posts 
(using post_id) 
wp_commentmeta 
(using comment_id) 
wp_commentmeta Comment metadata wp_comments 
(using comment_id)
THE WORDPRESS DATABASE 
STRUCTURE 
TABLE DATA STORED LINKED TO 
wp_users Users 
@michaelrmcneill 
#wcraleigh 
wp_posts 
(using post_author) 
wp_usermeta 
(using user_id) 
wp_usermeta Metadata for each user wp_users 
(using user_id)
THE WORDPRESS DATABASE 
STRUCTURE 
TABLE DATA STORED LINKED TO 
@michaelrmcneill 
#wcraleigh 
wp_links 
(DEPRECATED!) 
Information related to 
Links 
wp_term_relationships 
(using link_id) 
wp_options 
Site settings and options 
(set via the Settings 
screens and via plugins and 
themes) as well as widgets 
None
THE WORDPRESS DATABASE 
STRUCTURE 
TABLE DATA STORED LINKED TO 
wp_term_relationships Relationships between 
posts and taxonomies 
@michaelrmcneill 
#wcraleigh 
wp_posts 
(using post_id) 
wp_term_taxonomy 
(using term_taxonomy_id) 
wp_term_taxonomy Taxonomies (including 
categories and tags) 
wp_term_relationships 
(using term_taxonomy_id) 
wp_terms 
Your categories and tags 
and the terms assigned to 
custom taxonomies 
wp_term_taxonomy 
(using term_id)
HOW TO USE THE 
WORDPRESS DB? 
WordPress defines a class called wpdb, which 
contains a set of functions used to interact with a 
database. Its purpose is to provide an easy to use 
interface with the WordPress database. 
@michaelrmcneill 
#wcraleigh
$wpdb 
Methods in the wpdb() class should not be called 
directly. You should use the global $wpdb object 
instead. 
@michaelrmcneill 
#wcraleigh
A LARGE WARNING 
Any function that executes SQL queries, can be 
vulnerable to SQL injection attacks. To prevent that, 
you should escape all SQL. Make sure to review the 
______ to double-check if the function you plan to 
use escapes SQL for you or leaves it un-escaped! 
@michaelrmcneill 
#wcraleigh
TRICKS OF THE TRADE 
@michaelrmcneill 
#wcraleigh
VAGRANT AND VVV 
http://vagrantup.com 
https://github.com/Varying-Vagrant-Vagrants/VVV 
A great tutorial: http://tangrufus.com/start-wordpress- 
development-varying-vagrant-vagrants/ 
GIT AND GITHUB 
Great intro guide and cheat sheet: http:// 
rogerdudler.github.io/git-guide/ 
GitHub: https://github.com 
Deploy (Automated Deployment): https:// 
www.deployhq.com 
@michaelrmcneill 
#wcraleigh
QUESTIONS? 
@michaelrmcneill 
#wcraleigh
1 of 55

Recommended

5 Things You Shouldn't Do With A WordPress Plugin by
5 Things You Shouldn't Do With A WordPress Plugin5 Things You Shouldn't Do With A WordPress Plugin
5 Things You Shouldn't Do With A WordPress PluginKelly Phillips
2.1K views42 slides
Building the basics (WordPress Ottawa 2014) by
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)christopherfross
782 views69 slides
Theming in WordPress - Where do I Start? by
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Edmund Turbin
3.2K views41 slides
Let’s write a plugin by
Let’s write a pluginLet’s write a plugin
Let’s write a pluginBrian Layman
912 views17 slides
Page speed: low hanging legumes by
Page speed: low hanging legumesPage speed: low hanging legumes
Page speed: low hanging legumesErich
1.3K views33 slides
Neo word press meetup ehermits - how to keep your blog from being hacked 2012 by
Neo word press meetup   ehermits - how to keep your blog from being hacked 2012Neo word press meetup   ehermits - how to keep your blog from being hacked 2012
Neo word press meetup ehermits - how to keep your blog from being hacked 2012Brian Layman
962 views22 slides

More Related Content

What's hot

Getting started with WordPress development by
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
1.3K views33 slides
WordPress plugins by
WordPress pluginsWordPress plugins
WordPress pluginschristopherfross
5.8K views37 slides
WordPress APIs by
WordPress APIsWordPress APIs
WordPress APIsmdawaffe
13.2K views48 slides
[GeekTalk#2] Takaaki Mizuno - Api Url Design by
[GeekTalk#2] Takaaki Mizuno - Api Url Design[GeekTalk#2] Takaaki Mizuno - Api Url Design
[GeekTalk#2] Takaaki Mizuno - Api Url DesignNexus FrontierTech
206 views15 slides
Zero To WordPress Plubish by
Zero To WordPress PlubishZero To WordPress Plubish
Zero To WordPress PlubishMichele Butcher-Jones
553 views33 slides
CSI: WordPress -- Getting Into the Guts by
CSI: WordPress -- Getting Into the GutsCSI: WordPress -- Getting Into the Guts
CSI: WordPress -- Getting Into the GutsDougal Campbell
2.2K views32 slides

What's hot(20)

Getting started with WordPress development by Steve Mortiboy
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
Steve Mortiboy1.3K views
WordPress APIs by mdawaffe
WordPress APIsWordPress APIs
WordPress APIs
mdawaffe13.2K views
[GeekTalk#2] Takaaki Mizuno - Api Url Design by Nexus FrontierTech
[GeekTalk#2] Takaaki Mizuno - Api Url Design[GeekTalk#2] Takaaki Mizuno - Api Url Design
[GeekTalk#2] Takaaki Mizuno - Api Url Design
Nexus FrontierTech206 views
CSI: WordPress -- Getting Into the Guts by Dougal Campbell
CSI: WordPress -- Getting Into the GutsCSI: WordPress -- Getting Into the Guts
CSI: WordPress -- Getting Into the Guts
Dougal Campbell2.2K views
Building microservices with Node.js - part 2 by Ashley Davis
Building microservices with Node.js - part 2Building microservices with Node.js - part 2
Building microservices with Node.js - part 2
Ashley Davis225 views
Use WordPress to become a social proprietor by Terry Heenan
Use WordPress to become a social proprietorUse WordPress to become a social proprietor
Use WordPress to become a social proprietor
Terry Heenan1.7K views
Angular Remote Conf - Building with Angular & WordPress by Roy Sivan
Angular Remote Conf - Building with Angular & WordPressAngular Remote Conf - Building with Angular & WordPress
Angular Remote Conf - Building with Angular & WordPress
Roy Sivan457 views
JSON REST API for WordPress by Taylor Lovett
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
Taylor Lovett23K views
Why you should be using WordPress child themes by Anthony Hortin
Why you should be using WordPress child themesWhy you should be using WordPress child themes
Why you should be using WordPress child themes
Anthony Hortin227 views
The Why, When, How of WordPress Child Themes by Anthony Hortin
The Why, When, How of WordPress Child ThemesThe Why, When, How of WordPress Child Themes
The Why, When, How of WordPress Child Themes
Anthony Hortin474 views
WordCamp Minnepolis 2015: From Zero To WordPress Publish by Michele Butcher-Jones
WordCamp Minnepolis 2015: From Zero To WordPress PublishWordCamp Minnepolis 2015: From Zero To WordPress Publish
WordCamp Minnepolis 2015: From Zero To WordPress Publish
2010 11 pubcon_hendison_wordpress by shendison
2010 11 pubcon_hendison_wordpress2010 11 pubcon_hendison_wordpress
2010 11 pubcon_hendison_wordpress
shendison637 views
2010 11 pubcon_hendison-hosting by shendison
2010 11 pubcon_hendison-hosting2010 11 pubcon_hendison-hosting
2010 11 pubcon_hendison-hosting
shendison390 views
Using composer with WordPress by Micah Wood
Using composer with WordPressUsing composer with WordPress
Using composer with WordPress
Micah Wood1.2K views

Viewers also liked

The five things you should know about me by
The five things you should know about meThe five things you should know about me
The five things you should know about meKershtinViernes0422
279 views17 slides
WordPress Café: Using WordPress as a Framework by
WordPress Café: Using WordPress as a FrameworkWordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkExove
1.1K views46 slides
WordPress development paradigms, idiosyncrasies and other big words by
WordPress development paradigms, idiosyncrasies and other big wordsWordPress development paradigms, idiosyncrasies and other big words
WordPress development paradigms, idiosyncrasies and other big wordsTomAuger
6.4K views71 slides
10 Things CEOs Need to Know About Design by
10 Things CEOs Need to Know About Design 10 Things CEOs Need to Know About Design
10 Things CEOs Need to Know About Design Jason Putorti
73.1K views78 slides
презентация кп тутбери by
презентация кп тутберипрезентация кп тутбери
презентация кп тутбериСергей Строгонов
605 views10 slides
Beowulf by
BeowulfBeowulf
Beowulfms_faris
886 views11 slides

Viewers also liked(20)

WordPress Café: Using WordPress as a Framework by Exove
WordPress Café: Using WordPress as a FrameworkWordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a Framework
Exove1.1K views
WordPress development paradigms, idiosyncrasies and other big words by TomAuger
WordPress development paradigms, idiosyncrasies and other big wordsWordPress development paradigms, idiosyncrasies and other big words
WordPress development paradigms, idiosyncrasies and other big words
TomAuger6.4K views
10 Things CEOs Need to Know About Design by Jason Putorti
10 Things CEOs Need to Know About Design 10 Things CEOs Need to Know About Design
10 Things CEOs Need to Know About Design
Jason Putorti73.1K views
Beowulf by ms_faris
BeowulfBeowulf
Beowulf
ms_faris886 views
Minimal pairs clothes by Les Davy
Minimal pairs   clothesMinimal pairs   clothes
Minimal pairs clothes
Les Davy890 views
Aef4 12 by Les Davy
Aef4 12Aef4 12
Aef4 12
Les Davy422 views
Sentença do Tribunal da Itália sobre Pizzolato by Miguel Rosario
Sentença do Tribunal da Itália sobre PizzolatoSentença do Tribunal da Itália sobre Pizzolato
Sentença do Tribunal da Itália sobre Pizzolato
Miguel Rosario11.2K views
Как не испортить праздник by TOCHKA
Как не испортить праздникКак не испортить праздник
Как не испортить праздник
TOCHKA485 views
Lifestyle unit 6 by Les Davy
Lifestyle unit 6Lifestyle unit 6
Lifestyle unit 6
Les Davy618 views
3 concurrencycontrolone by Kamal Shrish
3 concurrencycontrolone3 concurrencycontrolone
3 concurrencycontrolone
Kamal Shrish196 views
Multimedia01 by Les Davy
Multimedia01Multimedia01
Multimedia01
Les Davy1K views

Similar to Things you should know about WordPress (but were always too afraid to ask): WordCamp Raleigh 2014

Alice Phieu - WordPress For Beginners by
Alice Phieu - WordPress For BeginnersAlice Phieu - WordPress For Beginners
Alice Phieu - WordPress For BeginnersAlice Phieu
8.9K views51 slides
Extending & Scaling | Dallas PHP by
Extending & Scaling | Dallas PHPExtending & Scaling | Dallas PHP
Extending & Scaling | Dallas PHPrandyhoyt
2.2K views50 slides
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事 by
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事Ronald Hsu
7.2K views114 slides
WordPress Customization and Security by
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and SecurityJoe Casabona
1.7K views54 slides
NEPA BlogCon 2013 - WordPress Customization & Security by
NEPA BlogCon 2013 - WordPress Customization & SecurityNEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & SecurityMichelle Davies (Hryvnak)
774 views54 slides
Everything WordPress by
Everything WordPressEverything WordPress
Everything WordPressEric Myers
598 views56 slides

Similar to Things you should know about WordPress (but were always too afraid to ask): WordCamp Raleigh 2014(20)

Alice Phieu - WordPress For Beginners by Alice Phieu
Alice Phieu - WordPress For BeginnersAlice Phieu - WordPress For Beginners
Alice Phieu - WordPress For Beginners
Alice Phieu8.9K views
Extending & Scaling | Dallas PHP by randyhoyt
Extending & Scaling | Dallas PHPExtending & Scaling | Dallas PHP
Extending & Scaling | Dallas PHP
randyhoyt2.2K views
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事 by Ronald Hsu
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
Ronald Hsu7.2K views
WordPress Customization and Security by Joe Casabona
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
Joe Casabona1.7K views
Everything WordPress by Eric Myers
Everything WordPressEverything WordPress
Everything WordPress
Eric Myers598 views
Developing Complex WordPress Sites without Fear of Failure (with MVC) by Mike Schinkel
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Mike Schinkel1.8K views
Best Practices for Building WordPress Applications by Taylor Lovett
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
Taylor Lovett6.1K views
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development by Evan Mullins
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
Evan Mullins356 views
Wordpress Beyond A Blog Word Camp Toronto08 by Jamie Oastler
Wordpress Beyond A Blog Word Camp Toronto08Wordpress Beyond A Blog Word Camp Toronto08
Wordpress Beyond A Blog Word Camp Toronto08
Jamie Oastler5.4K views
WordCamp Ireland - 40 tips for WordPress Optimization by Joost de Valk
WordCamp Ireland - 40 tips for WordPress OptimizationWordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress Optimization
Joost de Valk3.1K views
DrupalCon Austin - Absolute Beginner's Guide to Drupal by Rod Martin
DrupalCon Austin - Absolute Beginner's Guide to DrupalDrupalCon Austin - Absolute Beginner's Guide to Drupal
DrupalCon Austin - Absolute Beginner's Guide to Drupal
Rod Martin1.5K views
Best Practices for WordPress by Taylor Lovett
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPress
Taylor Lovett11.3K views
Best practices-wordpress-enterprise by Taylor Lovett
Best practices-wordpress-enterpriseBest practices-wordpress-enterprise
Best practices-wordpress-enterprise
Taylor Lovett680 views

Recently uploaded

"Surviving highload with Node.js", Andrii Shumada by
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada Fwdays
49 views29 slides
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TShapeBlue
81 views34 slides
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...ShapeBlue
121 views15 slides
Microsoft Power Platform.pptx by
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptxUni Systems S.M.S.A.
74 views38 slides
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
191 views23 slides
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPoolShapeBlue
56 views10 slides

Recently uploaded(20)

"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays49 views
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue81 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue121 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue191 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue56 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE67 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue147 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue93 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10110 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson142 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty54 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue86 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue134 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software373 views

Things you should know about WordPress (but were always too afraid to ask): WordCamp Raleigh 2014

  • 1. THINGS YOU SHOULD KNOW ABOUT WORDPRESS (but were always afraid to ask) Power Users Track WordCamp Raleigh 2014 Saturday, November 8th, 2014 Michael McNeill - @michaelrmcneill #wcraleigh
  • 2. ABOUT ME • Developer and Support Engineer in ITS Web Services at the University of North Carolina at Chapel Hill, where I help to manage two HUGE multisite networks that operate a total of almost 8,500+ sites. • Owner and Developer at MRMcDEV, Inc. my personal consulting company. • Co-Curator (Executive Director) of TEDxUNC, a non-profit organization dedicated to bringing “Ideas Worth Spreading” to Carolina. • I’ve been using WordPress for over 5 years now, and I use it for almost all my client projects. • I’ve worked on exciting and wide ranging projects, such as Black Enterprise Magazine, Mackay Communications, WiredHoods, smallbiztechnology.com, ALOHA, and MAXI Promotion and Records. I’ve also contracted for DRS Technologies, the United States Department of the Defense, and numerous other companies. @michaelrmcneill #wcraleigh
  • 3. A QUICK ROADMAP… 1. The WordPress APIs - What they are, how to find them, and how to use them. 2. The WordPress Template Hierarchy - What it is, which file generates a certain type of page, and how to use it to your advantage. 3. The WordPress Database - What is stored there, why it is stored there, how is it stored there, and how should you properly use the data inside it. 4. A few “tricks of the trade” - Version Control and Vagrant @michaelrmcneill #wcraleigh
  • 4. THE WORDPRESS CODEX @michaelrmcneill #wcraleigh
  • 5. BOOKMARK IT! http://codex.wordpress.org @michaelrmcneill #wcraleigh
  • 6. WHAT IS IT? The WordPress Manual written for all users, Designers and Developers alike. @michaelrmcneill #wcraleigh
  • 7. USE IT & IMPROVE IT. When you first have a question, go to the Codex first. The Codex is a living document, and anyone with a WordPress.org account can edit it and improve it. If you see something out of date, or flat out wrong, update it. @michaelrmcneill #wcraleigh
  • 8. THE WORDPRESS APIs @michaelrmcneill #wcraleigh
  • 9. WHAT’S AN API? • APIs are Application Programming Interfaces. • Think about it like this, APIs are basically a contract between two things stating: "If you tell me this, I will do this.” @michaelrmcneill #wcraleigh
  • 10. WHAT DO THE WORDPRESS APIs DO? • They help you do things using tools that WordPress gives you. • That makes development EASIER!! @michaelrmcneill #wcraleigh
  • 11. HOW DO I FIND THEM? • Identify what you are trying to do. • Then go to the ___________ and search for it. • If that doesn’t work, try using Google, just remember to cross-check against what the Codex says. @michaelrmcneill #wcraleigh
  • 12. HOW DO I USE THEM? • The format is basically the same across all function reference articles. • There are 3 primary sections. 1. The description of the function. 2. The parameters the function wants/needs. 3. What values, if any, the function returns. @michaelrmcneill #wcraleigh
  • 13. WORDPRESS PAGE LIFE CYCLE • The WordPress page life cycle is a combination of the events that take place from when a browser requests a page to when the server returns the rendered page to the browser. • That sounds simple, but there are a lot of things going on that get you the end result. @michaelrmcneill #wcraleigh
  • 15. WORDPRESS HOOKS • Hooks are extremely important to WordPress developers. • They enable us to literally hook into parts of the WordPress page life cycle to retrieve, insert, and modify data, and they allow us to take certain actions behind the scenes, before a user sees what is occurring. @michaelrmcneill #wcraleigh
  • 16. WORDPRESS HOOKS @michaelrmcneill #wcraleigh • Two Classifications • Actions • Actions are triggered by specific events that take place in WordPress, such as publishing a post, activating a plugin, or loading an admin screen. • For a comprehensive list of actions, check this Codex article out: http://codex.wordpress.org/Plugin_API/Action_Reference • Filters • Filters are functions that WordPress passes data through, that are primarily responsible for intercepting, managing, and returning data, before rendering or saving that data. • For a pretty comprehensive list of filters, check this Codex article out: http://codex.wordpress.org/Plugin_API/Filter_Reference
  • 17. WORDPRESS HOOKS • I’m sure you have the question, when should I use which hook? • Use actions when you want to add something to the existing page such as stylesheets, JavaScript, or send an email when an event has happened. • Use filters when you want to manipulate data coming out of the database prior to going to the browser, or coming from the browser prior to going into the database. @michaelrmcneill #wcraleigh
  • 18. THE WORDPRESS PAGE TEMPLATE HIERARCHY @michaelrmcneill #wcraleigh
  • 19. WHAT IS THE TEMPLATE HIERARCHY? WordPress templates fit together like the pieces of a puzzle to generate the pages on your WordPress site. Some templates (the header and footer templates for example) are used on almost all pages, while others are used only under specific conditions. The template hierarchy decides what template file or files WordPress will use to display a certain type of page. @michaelrmcneill #wcraleigh
  • 21. LET’S LOOK AT THE BASICS @michaelrmcneill #wcraleigh
  • 22. THE NEEDS OF A THEME • To have a functioning, bare minimum theme you need two things. • style.css - A stylesheet. • index.php - An index file that will render the output of the page. @michaelrmcneill #wcraleigh
  • 27. SINGLE POST RULES @michaelrmcneill #wcraleigh 1. single-post.php 2. single.php 3. index.php
  • 28. PAGE TEMPLATE RULES 1. Custom Template defined in WP Admin 2. page-<slug>.php 3. page-<id>.php 4. page.php 5. index.php @michaelrmcneill #wcraleigh
  • 29. HOME PAGE TEMPLATE RULES • front-page.php • Settings > Reading • Static Page 1. Follows the page template rules. @michaelrmcneill #wcraleigh • Blog Page 1. home.php 2. index.php
  • 30. SINGLE CUSTOM POST RULES 1. single-<posttype>.php 2. single.php 3. index.php @michaelrmcneill #wcraleigh
  • 31. CUSTOM POST TYPE RULES 1. archive-<posttype>.php 2. archive.php 3. index.php @michaelrmcneill #wcraleigh
  • 32. CATEGORY PAGES 1. category-<slug>.php 2. category-<id>.php 3. category.php 4. archive.php 5. index.php @michaelrmcneill #wcraleigh
  • 33. TAG PAGES @michaelrmcneill #wcraleigh 1. tag-<slug>.php 2. tag-<id>.php 3. tag.php 4. archive.php 5. index.php
  • 34. AUTHOR PAGES 1. author-<nicename>.php 2. author-<id>.php 3. author.php 4. archive.php 5. index.php @michaelrmcneill #wcraleigh
  • 35. ATTACHMENT RULES 1. MIME-type.php (e.x. text.php, video.php, image.php) 2. attachment.php 3. single_attachment.php 4. single.php 5. index.php @michaelrmcneill #wcraleigh
  • 36. CODEX ARTICLE http://codex.wordpress.org/Template_Hierarchy INTERACTIVE WEBSITE! http://wphierarchy.com/ @michaelrmcneill #wcraleigh
  • 38. WORDPRESS DATA • A WordPress website consists of three main elements: • The WordPress installation itself • The contents of the wp-content directory which includes the themes, plugins and uploads • The database, where all the content is stored. @michaelrmcneill #wcraleigh
  • 39. TYPES OF WORDPRESS CONTENT @michaelrmcneill #wcraleigh • posts • pages • custom post types • attachments • links • menu items
  • 40. ASSOCIATED DATA (POSTMETA) • categories • tags • custom taxonomies and terms • post metadata @michaelrmcneill #wcraleigh
  • 41. OTHER TYPES OF CONTENT @michaelrmcneill #wcraleigh • widgets • options • users • sites (for multisite)
  • 43. A FEW NOTES… • In the next few slides, I’m using the wp_ prefix by default. You can change this (and you might have), but the concepts are the same. • A multisite installation will have some extra tables. I haven't included those here as that's outside the scope of this presentation. @michaelrmcneill #wcraleigh
  • 44. THE WORDPRESS DATABASE STRUCTURE Most of the tables in the WordPress database are linked to one or more other tables via a specific field. This field is generally a unique ID for each record such as a post_id. @michaelrmcneill #wcraleigh
  • 45. THE WORDPRESS DATABASE STRUCTURE TABLE DATA STORED LINKED TO wp_posts Posts, pages, attachments, revisions and menu items @michaelrmcneill #wcraleigh wp_postmeta (using post_id) wp_term_relationships (using post_id) wp_postmeta Post metadata wp_posts (using post_id)
  • 46. THE WORDPRESS DATABASE STRUCTURE TABLE DATA STORED LINKED TO wp_comments Comments @michaelrmcneill #wcraleigh wp_posts (using post_id) wp_commentmeta (using comment_id) wp_commentmeta Comment metadata wp_comments (using comment_id)
  • 47. THE WORDPRESS DATABASE STRUCTURE TABLE DATA STORED LINKED TO wp_users Users @michaelrmcneill #wcraleigh wp_posts (using post_author) wp_usermeta (using user_id) wp_usermeta Metadata for each user wp_users (using user_id)
  • 48. THE WORDPRESS DATABASE STRUCTURE TABLE DATA STORED LINKED TO @michaelrmcneill #wcraleigh wp_links (DEPRECATED!) Information related to Links wp_term_relationships (using link_id) wp_options Site settings and options (set via the Settings screens and via plugins and themes) as well as widgets None
  • 49. THE WORDPRESS DATABASE STRUCTURE TABLE DATA STORED LINKED TO wp_term_relationships Relationships between posts and taxonomies @michaelrmcneill #wcraleigh wp_posts (using post_id) wp_term_taxonomy (using term_taxonomy_id) wp_term_taxonomy Taxonomies (including categories and tags) wp_term_relationships (using term_taxonomy_id) wp_terms Your categories and tags and the terms assigned to custom taxonomies wp_term_taxonomy (using term_id)
  • 50. HOW TO USE THE WORDPRESS DB? WordPress defines a class called wpdb, which contains a set of functions used to interact with a database. Its purpose is to provide an easy to use interface with the WordPress database. @michaelrmcneill #wcraleigh
  • 51. $wpdb Methods in the wpdb() class should not be called directly. You should use the global $wpdb object instead. @michaelrmcneill #wcraleigh
  • 52. A LARGE WARNING Any function that executes SQL queries, can be vulnerable to SQL injection attacks. To prevent that, you should escape all SQL. Make sure to review the ______ to double-check if the function you plan to use escapes SQL for you or leaves it un-escaped! @michaelrmcneill #wcraleigh
  • 53. TRICKS OF THE TRADE @michaelrmcneill #wcraleigh
  • 54. VAGRANT AND VVV http://vagrantup.com https://github.com/Varying-Vagrant-Vagrants/VVV A great tutorial: http://tangrufus.com/start-wordpress- development-varying-vagrant-vagrants/ GIT AND GITHUB Great intro guide and cheat sheet: http:// rogerdudler.github.io/git-guide/ GitHub: https://github.com Deploy (Automated Deployment): https:// www.deployhq.com @michaelrmcneill #wcraleigh