Plugins and themes are the backbone of WordPress, but many people, including developers and general users, get confused about what each is supposed to do. Most of the time, this isn’t an issue, but when it does become an issue, it can cause confusion, “loss” of data and a headache for users. This talk will go over what a theme should be, what a plugin should be, why they are that way, what users should look for in a plugin or theme and finally we’ll quickly discuss child themes and custom functionality plugins.
2. Who I am
• Always wanted to be a sports
journalist
• Worked in sports at The Daily
Texan
• Graduated from the University of
Texas at Austin with Journalism
degree
• Covered the 2016 Rio de Janeiro
Olympics
3. What I do with WordPress
• Started working with WordPress
in 2009
• Created a custom theme for
arena football website
• Four Themes and Four Plugins
in their respective WordPress
directories
• Web Developer for Faith
Growth for four years
• Now web developer at UNT HSC
5. Theme Definition
• A WordPress Theme is a collection of files that work together to
produce a graphical interface with an underlying unifying design
for a weblog. A Theme modifies the way the site is displayed,
without modifying the underlying software.
• - WordPress Codex
6. Plugin Definition
• A plugin is a piece of software containing a group of functions that
can be added to a WordPress website. They can extend
functionality or add new features to your WordPress websites.
WordPress plugins are written in the PHP programming language
and integrate seamlessly with WordPress.
• - WPBeginner
7. Simplified Definitions
• Themes control the design and
look of the front end of your
WordPress website.
• Ex. Genesis, Twentysixteen
• Plugins add functionality to
your website.
• Ex. Jetpack, Yoast SEO,
Gravity Forms
10. Example: Office Responsive Business Theme
• Really good design.
• But it adds in functionality that shouldn’t be in a theme.
• Adds seven custom post types. All that data will be “lost” if the
user changes themes.
11. How do you fix this?
• Create a functionality plugin
• Bundle with the theme
• Add all of the code for custom post types, custom taxonomies, Gutenberg
blocks, etc.
• Keeps the data on the site even if the user switches themes
13. Key Takeaways
• Developers: if you want to put a plugin or theme inside the
respective WordPress repo, make sure it follows the
design/functionality guidelines.
• Bloggers and business people: Check your themes to see if they
add functionality. Be wary if it does.
• If it does add functionality and you still want to use it, create a
custom plugin and move the functionality code into it.
15. Case Study: Lawrenceville Presbyterian
• Had a developer who built website based off of one of the default
themes.
• Church volunteer updated everything — WordPress, Plugins,
Themes.
• All of the changes were overwritten effectively making the front
end unusable.
• Situation could have been avoided if the original developer had
used a child theme.
16. Child Themes
• A child theme is a theme that inherits the functionality and styling
of another theme, called the parent theme.
• Allows users to make changes to styles and template parts without
the fear of losing the changes when a theme update is released.
• Very simple to set up.
17. Child Theme Example: Genesis
• Genesis is a theme
framework that makes
building child themes easier.
• All of the themes found on
StudioPress
(https://my.studiopress.com
/themes/) are child themes
of Genesis.
18. Creating a Child Theme
• Need three things: child theme directory, functions.php file and
style.css file.
• Functions.php file:
• add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
19. Creating a Child Theme
• Style.css file:
• /*
Theme Name: Child Theme Name
Theme Description:
Author:
Template: theme-slug
Version: 1.0.0
*/
• Links to more info:
• https://www.smashingmagazine.com/2016/01/create-customize-
wordpress-child-theme/
20. Additional CSS Option
• In WordPress 4.7, an “Additional CSS” option was added to the
Customizer.
• Works great for small CSS fixes.
• For more customizations, use a child theme.
21. Custom Plugins
• Custom plugins, or functionality plugins, can act as an extra
functions.php file.
• Custom plugins are a great place to put code that changes
WordPress.
• Examples
• Create custom post types
• Create custom taxonomies
• Add logo to login
• Gutenberg Blocks
• Etc.
• Code here won’t change when you change themes.
• Very simple to create.
22. Creating a custom plugin
• Only two things are needed: plugin directory and a PHP file.
• The PHP file needs to be the same name as the directory.
• Example
• Plugin directory: jm-portfolio-customizations
• Main PHP file: jm-portfolio-customizations.php
• You can have more than one file in you plugin. Will need to call
those files from the main plugin PHP file.
23. Creating a Custom Plugin
• Plugin PHP file
• /*
Plugin Name: JM Portfolio Customizations
Plugin URI: https://www.jacobmartella.com/
Description: A place for all of the plugin customizations for my portfolio
site.
Version: 1.0
Author: Jacob Martella
Author URI: http://www.jacobmartella.com
License: GPLv3
Text Domain: jm-portfolio-customizations
*/
• Rest of your code follows.