Site icon Webrock Media Private Limited

WordPress Theme & Plugin Development

WordPress Theme & Plugin Development

Custom WordPress Plugins

What Will You Learn?

Points Description
Getting Ready for WordPress Development       9 lectures, 49min
PHP for WordPress 16 lectures, 1hr 32min
Child Themes and Starter Themes 8 lectures, 37min
The Template Hierarchy 42 lectures, 4hr 55min
Template Tags 45 lectures, 3hr 59min
Action and Filter Hooks in WordPress 34 lectures, 2hr 23min
Plugin Development 22 lectures, 1hr 54min

Getting Ready for WordPress Development

Course Introduction

Here we introduce the course structure and an overall learning curriculum. This course needs your proficiency with HTML and CSS, so we recommend you to learn that first.

Topics Covered By The Course:

The mentor will give you a real-time demonstration to build a theme and plugin and the candidates need to follow this intensively. All the knowledge and details about building one’s own themes and plugins will be explained by the faculty.

Next up, we’ll look at how to set up our local WordPress environment to run WordPress on the computer.

Setting Up WordPress Locally

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 the computers:

1. DesktopServer from ServerPress

In this lesson, we understand how to run WordPress locally using DesktopServer from ServerPress.

2. Local from Flywheel

Here we learn the ways to run WordPress locally using Local from Flywheel.

Editing WordPress Files Locally

Finding the WordPress files that you will need to edit when you work with Desktop and Local, is all explained in the editing process.

Introduction to Staging

Pulling from Production to Staging to Local

Pushing from Local to Staging to Production

PHP for WordPress

Introduction

Here we introduce the section on ‘PHP for WordPress’ and go over on what we will learn in forth-coming studies:

A quick glimpse on what we will learn:

What is PHP?

PHP stands for “PHP: Hypertext Preprocessor” and runs before the HTML for a web page is generated. PHP generally works in WordPress and can be used outside of WordPress as well. It is used to build sites and applications.

PHP Review:

Writing Some Basic PHP

The basic writing of PHP is introduced here.

Aspects Covered:

PHP Programming Basics

In the text lessons, we outline some of the basics related to working with PHP that we must 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.

PRACTICE – PHP Basics

Here 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.

WordPress PHP Coding Standards

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 reading through these now and checking back on them again at different points in the course. You will master these all in the due course.

Different Types of PHP Files in WordPress

In general, you will find three available types of PHP files in WordPress:

WordPress Core Files

These control how WordPress works, not edited, but exciting and possibly helpful to read through or study.

WordPress Theme Files

These control how themes work and display content. When you are building or customizing a child theme, you will edit these files.

WordPress Plugin Files

These are used when building plugins. If you are writing your own plugin or extending another plugin, you will edit these files, but you would not generally directly edit the code of another plugin.

Include Files

Small PHP files included in larger files appear in Core, Theme, and Plugin files.

You will likely come across and write them yourself.

The Loop

The Loop combines 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 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 learn at a later time in the course.

PRACTICE – The Loop

Now it’s time to practice using PHP Loop on your own:

Try tackling this yourself, then follow along with me as I show you the approach I took.

Template Tags

Template tags are special functions that allow us to get information and content from WordPress easily.

Some popular template tags include:

PRACTICE – Template Tags

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 🙂

WordPress Conditionals

Conditional Tags are WordPress functions that return true when certain conditions are met.

Some common conditional tags include:

PRACTICE – Conditional Tags

Now that you’ve learned about Conditional Tags, let’s try practicing writing some:

WordPress Hooks

Hooks allow you to add custom code to existing software.

Two types of hooks exist in WordPress:

1. Action Hooks let you run your code when certain events take place in the WordPress run cycle.

2. Filter Hooks let you modify how content is displayed on a page or saved to the database.

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 );

?>

PRACTICE – WordPress Hooks

Now it’s time to practice writing some hooks on your own.

Try the following:

PHP for WordPress Review

Some important points for review:

Child Themes and Starter Themes

Child Themes vs Starter Themes

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 – Customizing an existing theme

Starter Theme – Building sites from scratch.

Child Theme Basics

Child Theme

Some Other Aspects of Child Theme:

DEMO – Child Theme

In this lesson, we take a look at a child theme in action.

PRACTICE – Child Themes

Now it is time for you to practice making a child theme:

Starter Theme Basics

Starter Theme Basics:

DEMO – Underscore Starter Theme

PRACTICE – Starter Themes

In this lesson, I encourage you to go practice working with a starter theme on your own:

WARNING: Not all starter themes are created equal

Child and Starter Themes Review

Child Theme Review:

 

Exit mobile version