
Welcome! In this first lesson we go over what we will learn in this course.
This course does not teach, but does use HTML and CSS, so we recommend you learn that first.
Overall the course covers the following topics:
Throughout the course you will follow along with me as I build a theme and plugin and have the opportunity to build your own theme and plugin as well :)
Next up we'll look at how to setup our local WordPress environment so we can run WordPress on our computer.
Local WordPress Development refers to running WordPress on your computer and editing the files locally, on your computer, rather than using a hosted version of WordPress to develop with.
We look at a few different options for locally running WordPress on our computers:
In this lesson we look at how to run WordPress locally using DesktopServer from ServerPress.
In this lesson we look at how to run WordPress locally using Local from Flywheel.
In this lesson we look at how to find the WordPress files that you will need to edit when you work with Desktop and Local.
Learn to pull a live WordPress site from production to staging and to local development using a staging setup, the all-in-one migration plugin, and URL adjustments.
In this lesson we introduce this section on PHP for WordPress and go over what we will learn in the coming lessons:
Next up we answer the question, "What is PHP?"
In this lesson we learn the PHP stands for "PHP: Hypertext Preprocessor" and runs before the HTML for a web page is generated. PHP runs a lot in WordPress and can be used outside of WordPress as well to build sites and applications.
PHP Review:
Next up we practice writing some PHP.
In this lesson we start to write some basic PHP.
Covered in this lesson:
Next up we learn some more PHP Programming Basics.
In text lesson we outline some of the basics of working with PHP that are important for us to know going forward. Read through and absorb what you can and in the next lesson we will look at putting some of this into practice.
In this lesson we work on the following practice exercise:
Try practicing this on your own before checking out the completed solution and the walk through in the video.
In this lesson we learn about the WordPress Coding Standards.
These are guidelines and suggestions for how to write and format your PHP when working with WordPress.
You can access the WordPress PHP Coding Standards here: https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/
The WordPress Coding Standards contain information around the following topics:
Not all of these may make sense to you at this point so try taking a read through these now and check back on them again at different points in the course.
In general you will find three general types of PHP files in WordPress:
The Loop is a combination of a conditional statement and loop that intelligently gathers and prepares post or page content to display.
It consists of the following:
A basic loop looks like this:
```
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; else: ?>
<h2><?php esc_html_e( '404 Error', 'phpforwp' ); ?></h2>
<p><?php esc_html_e( 'Sorry, content not found.', 'phpforwp' ); ?></p>
<?php endif; ?>
```
Notice that since the PHP code is inside various self contained PHP blocks, it is also possible to use HTML inside of the Loop.
It is also possible though to have a pure PHP loop without any HTML being included between PHP blocks:
```
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
the_title( ’<h1>', ’</h1>' );
the_content();
endwhile; else:
_e( 'Sorry, no pages matched your criteria.', 'textdomain' );
endif; ?>
```
It is also possible to customize the Loop, which we will look at late in the course.
Now it's time to practice using PHP Loop on your own:
Try tackling this on your own then follow along with me as I show you the approach I took.
Template tags are special functions that allow us to easily get information and content from WordPress.
Some popular template tags include:
Now that we've learned about template tags, it's time for you to tackle some practice on your own:
After you take a stab on your own, you can follow along with my solution :)
Conditional Tags are WordPress functions that return true when certain conditions are met.
Some common conditional tags include:
Now that you've learned about Conditional Tags, let's try practicing writing some:
Hooks allow you to add custom code into existing software.
Two types of hooks exist in WordPress:
Here is an example of an Action Hook in use:
```
<?php
function my_theme_styles() {
wp_enqueue_style( 'main-css', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'my_theme_styles' );
?>
```
Here is an example of a Filter Hook in use:
```
<?php
function my_read_more_link( $excerpt ) {
return $excerpt . '<a href="' . get_permalink() . '">Read more</a>';
}
add_filter( 'get_the_excerpt', 'my_read_more_link', 10 );
?>
```
Now it's time to practice writing some hooks on your own.
Try the following:
Some important points for review:
A Child Theme allows you to override another theme (parent theme) without making direct changes that are lost during updates.
A Starter Theme includes helpful files and functions for building themes from scratch. You usually edit starter themes directly, not using child themes.
Here is when to use each:
Child Theme
Parent Theme
In this lesson we take a look at a child theme in action.
Now it is time for you to practice making a child theme:
Starter Theme Basics:
In this lesson I encourage you to go practice working with a starter theme on your own:
Child Theme Review:
Explore the WordPress template hierarchy and how templates like page.php, single.php, category.php, and tag.php control content display, with fallback to index.php when templates are missing.
Configure the WordPress style.css header with theme metadata to display details in the appearance themes dashboard, using WP Hierarchy as the example.
Discover how to configure a WordPress theme via the functions.php file by enabling theme support for post formats, post thumbnails, HTML5 features, the title tag, and enqueueing styles.
Explore index.php as the fallback template in WordPress theme development, illustrating the WP hierarchy, combining HTML and PHP, using hard-coded data, and preparing shared header and footer templates.
Create and load header.php in WordPress, implement custom headers (such as header-splash), use get_header to switch headers, and ensure wp_head loads styles, scripts, and title tags.
Add footer markup with a link to WordPress.org and a translatable 'powered by WordPress' label, ensuring splash pages function and final downloads reflect the updates.
Explore dynamic templating with the WordPress loop, building index.php around have_posts and while have_posts to display posts, handle 404s, and streamline with template parts.
Break up the theme's loop into modular, reusable pieces using template parts, content.php and content-none.php, organized in a template-parts folder and loaded with get template part.
Explore how the singular.php template fits WordPress hierarchy, with fallbacks from page, single, and attachment to singular, then to index. Decide when to use or omit singular.php to avoid redundancy.
Explore the WordPress template hierarchy by using single post templates, explain when to use single.php versus single-post.php, and how custom post types like portfolio affect fallback behavior.
Learn to integrate a comments.php template into your WordPress theme, load and style post comments, and conditionally display them when comments are open or closed on single posts.
Learn how to implement WordPress post formats, use get post format and get template part to create format-specific templates like gallery, video, and quote, with practical testing and dashicons cues.
Learn to implement home.php as the blog homepage, toggle latest posts or a static page, and convert the loop into linkable excerpts with permalinks, pagination, and template variations.
Learn how archive.php powers WordPress category, tag, and author archives by copying home.php, creating a generic archive template, and implementing fallbacks to index.
Explore the author.php template to display an author bio and their posts on the author archive page, using the author posts link and author meta.
Explore author-id.php and author-nicename.php templates as author-specific fallbacks, showing how to apply per-author templates, considerations about id versus nice name, and using body class for targeted styling.
Learn how to build WordPress category archive templates with category.php, including category-id and category-slug variants. Add category descriptions and CSS-driven styling to tailor category pages.
Explore how WordPress attachment templates route by mime type, using mime-specific templates (image.php, video.php, pdf.php) with fallbacks, and inspect post data and metadata to build flexible media templates.
Explore mime type templates in WordPress by building generic attachment pages for image, video, and text using attachment dot PHP, template parts, and get post mime type.
Explore page templates in WordPress, extending page.php and using page id and slug. Customize sidebars for pages with page-specific widgets and understand fallbacks to singular.php and front-page.php.
Create a front-page.php template and set a home page to enable a front-page widget area. Move the sidebar into the primary div and register the front-page widget area in functions.php.
Design a robust 404.php template that gracefully handles not found content with an index fallback and optional search or page lists to guide visitors.
Explore when to use site search and how to implement a flexible WordPress search template, including search.php, template parts, and displaying post types, excerpts, and the search query.
Explore how to build and load single pages for custom post types in WordPress, using single-portfolio.php, fallback to single.php and singular.php, and integrate custom fields with Advanced Custom Fields.
Learn to append the custom post type slug as a hyphen suffix to a portfolio template, use template parts to avoid duplication, and style with body classes or post IDs.
Set up custom taxonomies in WordPress, then build a generic archive template with taxonomy.php to display taxonomy terms on portfolio items and link to taxonomy pages.
Learn to implement custom taxonomy archives in WordPress using taxonomy.php and taxonomy-{taxonomy}.php. Customize the skills taxonomy with a portfolio-style archive and targeted term templates, including PHP, with CSS adjustments.
Master how to load multiple CSS files in a WordPress theme by enqueuing styles, managing dependencies with the main CSS, and optionally including external fonts.
Master the WordPress template hierarchy, including index.php as the fallback, and learn to implement headers, footers, sidebars, widget areas, custom templates, archives, 404 and search pages, and front page behavior.
Discover the basics of WordPress template tags, including the underscore version and get underscore version, parameter use, and examples with titles and permalinks, plus hooks and filters for output control.
Explore general template tags in WordPress, including include, login, blog info, archive, calendar, and miscellaneous tags, and preview how we’ll examine their functions in upcoming lessons.
Learn general WordPress template tags, including get header, get footer, get sidebar, and get template part, with parameters and defaults, plus how to read their documentation.
Explore WordPress login tags, including login out and log in out, login url, log out url, and login form, and learn to display them dynamically with is_user_logged_in and optional redirects.
Explore the blog info template tag and get blog info; learn parameters like name, description, and URL, and note deprecated items with alternatives like home URL or blog info URL.
Discover WordPress archive tags like single post title, post type archive title, and single term title, plus date archives and archive links, including Get Archives Link and WP Get Archives.
Explore wp get archives and get archives link to display archive lists with yearly, weekly, monthly, or alpha formats, post counts, and order, and compare sidebar code with dynamic widgets.
Learn how the get calendar tag in WordPress displays a calendar that links dates to category archives, with optional initial and echo settings, and how to use widgets.
Practice building a WordPress theme from scratch using header, footer, and sidebar include tags. Load functions.php and style.css, display blog info, and add a sidebar with login/logout, calendar, and archives.
Practice building a WordPress theme by including header, sidebar, and footer, using bloginfo for site details, login/logout options, a calendar and archives in the sidebar, and archive titles.
Master WP nav menu and register nav menus in functions.php to set up custom menus. Learn key arguments, wrappers, depth, and fallback options for flexible navigation.
Explore how WordPress assigns default CSS classes to navigation menus, such as current menu item and current page, and learn to inspect and style them for theme customization.
Leverage the Walker class to customize WordPress navigation output for bootstrap-style menus, wiring bootstrap CSS and WP Bootstrap Walker nav PHP via functions.php for a tailored menu.
Practice building header and footer navigation menus with WordPress navigation tags, experiment with different parameters, and add custom menus to two themes including header, footer, and sidebar placements.
Practice implementing navigation tags by configuring header and footer menus, defining main and footer theme locations, and adjusting depth and callback settings in functions.php for two distinct menus.
Explore how post tags in WordPress provide CSS classes, date data, pagination links, attachments, and get_ tags that return data across posts, pages, and custom post types.
Learn how body class and post class template tags add CSS classes to your WordPress theme for custom styling and semantic information.
Explore the most common WordPress post tags, including ID, title, content, excerpt, category, and tags, and learn how to use their parameters and wrappers in themes and queries.
Learn how WordPress excerpts work—auto, custom, and more tag behavior—and how to display categories and tags with separators and before/after options.
Learn to use WordPress date and time tags, apply PHP date formats, and handle listing behavior when dates repeat to display accurate post metadata.
Learn about the less common post tags, including permalink, title attribute, short link, and post meta with get_post_meta, plus displaying custom fields like location and lodging.
Explore the difference between get_ and the_ prefixed WordPress template tags, learn when to echo versus return values, and how to use get_the_title and related functions in themes and plugins.
Practice implementing WordPress tags by adding body and post classes and rendering title, content, and date or time. Set up previous and next post links on listing and single views.
Master enabling and displaying post thumbnails for posts, pages, and custom post types via functions.php, using theme support and template tags like the_post_thumbnail and has_post_thumbnail.
Enable post thumbnails in your WordPress theme and display them on listing and single pages using thumbnail tags with proper size and alignment, while choosing echo or get appropriately.
Explore WordPress link tags in depth, from permalinks and get permalink alternatives to editing and deleting post links, and to home, site, search, and RSS links.
Practice implementing permalink or get permalink in your WordPress theme, add edit post and edit pages links for front-end editing, and use home URL or site URL where appropriate.
Master WordPress template tags by using permalink and get_permalink, home url, and site url across header, index, and sidebar, with edit post and logout links.
Explore how WordPress handles common comment tags, including author, avatar, date, time, text, and IDs, plus nested threaded comments, replies, pagination, and open/closed settings.
Practice wiring WordPress comment templates with a custom function and a WP list comments callback to load templates, enable reply scripts, and explore styling, nesting, and pagination.
Master author tags and get author meta to display display name, user login, email, nickname, first and last name, avatar, and author archive links in WordPress themes.
Practice adding author name and a link to the author archive in post bylines, and display a featured author bio with gravatar. Create an author.php template and style author metadata.
Explore WordPress conditional tags to tailor displays by context, such as home pages, single posts, and post types, and use current_user_can for capabilities while avoiding slowdowns with templates.
Master sanitization, escaping, and localization in WordPress to secure data and enable translations with template tags. Sanitize input before storage, escape output for safety, and localize with translation hooks.
Learn to apply WordPress sanitization tags, including sanitize text, sanitize title, sanitize email, sanitize HTML classes, and escape URL raw, to securely handle input and prevent injection.
Master escaping tags in WordPress development by comparing escaping with sanitizing, and learn to safely render html, urls, js, attributes, and text areas as late as possible to protect users.
Review the WordPress template tags and the template hierarchy, practice using them in a site or a child theme to customize templates, then prepare to study WordPress hooks.
Explore hooks in WordPress to customize default behavior with action hooks and filter hooks. Understand the WordPress lifecycle and how to retrieve, modify, and return data for display.
Discover how do_action and add_action hooks work in WordPress core, and learn to locate and hook into actions like admin head and delete post.
Drill down into WordPress hooks by inspecting WP actions and WP filters to see which functions attach to each hook and how priorities shape callbacks.
Explore WordPress action hooks using the debug bar and debug bar actions and filters plugins, viewing core and plugin hooks and the admin bar and footer renders.
Explore how WordPress action hooks work, and learn to create custom hooks with do action, then connect to core hooks and practice with widgets, loop, template redirect, and save post.
Learn to create and hook into WordPress action hooks with do_action, attach footer functions, and load templates using locate_template for cleaner, extensible themes, child themes, and plugins.
Explore the WordPress enqueue_scripts action hook to load CSS and JavaScript with dependencies, and observe default priority and conditional loading for performance on specific pages.
Explore advanced WordPress action hooks, loading admin and editor styles, using pre get comments and caldera forms hooks, and debugging with a var dump to tailor admin behavior.
Explore filter hooks in WordPress by retrieving data that would normally be displayed, customizing it within your function, and returning the customized data to WordPress.
Learn to discover functions hooked into WordPress filters using $wp_filter, exploring content and excerpts as they pass through filter chains, with priorities and practical hook creation.
Explore how to reveal WordPress filter and action hooks with the R Debug Library, drill into priorities, and view live hooks on header and content for development.
Explore how the Simply Show Hooks plugin reveals which functions are hooked into filter hooks on both the front end and back end of WordPress, with search and toggle options.
Explore practical demos of WordPress filter hooks, starting with applying filters to roll our own hook, then extending title, content, excerpt, body class, and admin columns with custom filters.
Learn to hook into the WordPress the_title filter, format titles in the loop with a WP Tags Title Markup function, and return adjusted titles as h1 or h2 with links.
Explore the content filter in WordPress by hooking into the_content to insert an ad after the middle paragraph, using PHP, preg_match_all, and a loop check.
Explore how the excerpt_more filter customizes the end of WordPress excerpts by creating a custom read more link with the post permalink, while safely escaping HTML.
Explore how to customize WordPress page classes using the body_class filter by hooking into functions.php, inspecting the body class array, and conditionally adding classes for CSS styling.
Learn to customize WordPress admin lists using the manage_post_columns filter to modify back-end columns. Unset unwanted columns and optionally add a post ID column, with hooks for certain users.
Practice selecting three WordPress filter hooks from documentation or WordPress core, implement custom functions, and customize examples to fit your goals, preparing for the next lesson.
Explore the shift from theme development to plugin development in WordPress, comparing functions.php versus plugins and showing when to extract functionality into a standalone plugin.
Explore how to set up WordPress plugins from a single php file to a matching directory, ensuring unique names, security checks, includes, and basic activation.
Learn how to craft a WordPress plugin header: a PHP comment with name, URI, description, version, author, license, text domain, and domain path, visible in admin and repositories.
Learn to build plugin settings pages in WordPress by hooking into the admin menu, using add_menu_page, defining slugs and capabilities, and creating a callback to render secure, translatable admin markup.
Explore building plugin settings sub pages in WordPress, adding sub menus to the main plugin page or existing admin menus. Create pages with callbacks and slugs.
Learn how to add a direct settings link from the plugin listing using the plugin action links filter, improving access to WordPress admin settings.
Master plugin file paths using plugin base name, plugin directory path, and plugins URL to link files within plugin. Place path setup in the main plugin folder to ensure consistency.
Learn to enqueue JavaScript in a WordPress plugin for admin and front end, using the plugin URL, admin enqueue scripts, and wp_enqueue_scripts, with jQuery as a dependency.
Create a WordPress plugin with a basic settings page, enqueue JavaScript and CSS, and test the setup. Extend with hooks, front-end styles, and optional submenu organization.
Master a WordPress plugin setup with a comment header, admin settings, and a footer; load scripts and styles only on plugin page and prepare for saving options to the database.
Explore saving data in the WordPress options table, understand the database architecture, and learn add, update, delete, and get option operations for plugins.
Explore saving complex data in WordPress by storing arrays in the options table. Learn how to use named arrays, update and get options, and understand serialized arrays in the database.
Create a basic WordPress plugin, save a string or an array of options to the options table, and display it on the plugin settings page.
Learn how to use the Settings API to build admin forms that edit options in WordPress, including creating sections and fields, adding pages, and saving data to the options table.
Learn how to add setting sections via the Settings API in WordPress, activate our settings section plugin, and configure titles, descriptions, and page associations.
Create and configure settings fields on a WordPress plugin page, register settings, and store custom text in the options table using the Settings API for seamless front-end and database integration.
Explore creating multiple settings fields, including text input, text area, checkbox, radio, and select, with unique callbacks using the WordPress settings API. Save and recall these values in the database.
Develop a solid foundation in WordPress plugin development by reviewing concepts, examining others' plugins, and applying best practices to keep plugin code modular. Prepare to explore WordPress APIs.
WordPress is the leading Content Management System on the market, powering a large percentage of the Web. The need for WordPress Developers who can build and customize themes and plugins is ever growing. Learn from one of the most recognized educators in the WordPress world, Zac Gordon, who has taught thousands of people now employed as WordPress Developers.
If you want to learn everything from customizing existing themes, building custom themes or starting to build plugins, this course is for you. You will learn in depth how WordPress works under the hood, from template files and tags to hooks and internal APIs. If you are looking to build bigger and more custom projects with WordPress or just get a good job with a great company building WordPress projects, then this course is for you. Make sure though you can already build and style a basic web page with HTML and CSS as we assume you already know this and focus more on learning PHP.
When you learn the skills this course contains you will feel incredibly empowered to build almost anything you can imagine with WordPress. You should also feel confident working professionally in the field as a WordPress Developer. You will have built a theme and plugin along with the course as well as a theme and plugin of your own. Follow in the path of thousands of others of Zac's students who learned WordPress Development and went on to do great work in the field.