Getting the Most out of Genesis
Josh Lee
About Me
- Developer since 2006
- WordPress developer & consultant since 2010
Contact Me
Why Use a Theme Framework?
The case for frameworks
- Build sites faster with more features
- Create consistency for easier code re-use
- Get the security update benefits of a much larger team
Other Frameworks
Thesis
Divi
... so many more
Why Genesis?
Why Genesis?
-
The best framework for content marketing
-
Very developer-friendly
-
The most WordPress-y
Out of the Box
Out of the Box Features
-
SEO Metadata
-
Multi-column Layouts
-
Page Templates
-
Widget Areas
Great Plugins
Great Plugins
- Genesis Simple Sidebars
- Genesis Simple Edits
- Genesis Simple Share
- ... tons more
(find all of these in the WordPress.org plugin directory)
Developer Features
Developer Features
-
Functional Templating (no code duplication)
-
Easy to turn off or modify built-in features
-
Incredible code reusability
There is a learning curve...
Learning Curve:
-
Child Themes
-
Hooks & Filters
-
Debugging
-
Undocumented Hooks
-
Functional Templating
Child Themes
Child Themes
A child theme lets you override specific files from a theme without modifying the original theme
This is very useful for modifying CSS
Anatomy of a Child Theme
Anatomy of a Child Theme
-
style.css
-
functions.php
-
templates
All it Takes
/*
Theme Name: Bootstrap Genesis
Theme URL: http://ironcodestudio.com/bootstrap-genesis-theme/
Description: Bootstrap Genesis Child Theme.
Author: salcode
Author URI: http://ironcodestudio.com/
Version: 0.8.2
Template: genesis
*/
(Refers to the folder name of the parent theme)
Warning
Not all base themes will support overriding PHP functionality
But Genesis Does
Genesis Supports Child Themes:
- Theme support
- Helper funtions
- Hooks & filters
Hooks & Filters
Hooks
A hook is an anchor for you to run code during certain events, such as:
-
A page is requested
-
The scripts are printed in the page header
-
The main “loop” for the page is run
Hooks
Filters
A filter is like a hook, except that you can manipulate incoming data and return a new result
Hooks and filters allow you to modify core behavior (or other plugins or themes) without modifying or overriding the original code.
Genesis Template Hooks
Genesis Template Hooks
-
Genesis uses hooks to build up the page template and render the results of the loop
-
Now you can modify templates without overriding them
-
No longer necessary to duplicate entire templates or manage nested sub-templates just for small changes.
Genesis Templates
Call genesis() at the end of a php file with action hooks and filters.
Which Hooks to Use?
Which Hooks to Use?
Getting the Most out of Genesis
By Josh Lee
Getting the Most out of Genesis
- 740