Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Swapping Old Contexts
Lab: Markup & Wraps – Developer’s Guide to Customizing Genesis
Video Runtime: 09:37
In the last episode, you saw that genesis_structural_wrap
deals with swapping out old contexts and replaces them with the one versions.
//* Map of old $contexts to new $contexts | |
$map = array( | |
'nav' => 'menu-primary', | |
'subnav' => 'menu-secondary', | |
'inner' => 'site-inner', | |
); | |
//* Make the swap, if necessary | |
if ( $swap = array_search( $context, $map ) ) { | |
if ( in_array( $swap, $wraps[0] ) ) | |
$wraps[0] = str_replace( $swap, $map[ $swap ], $wraps[0] ); | |
} |
How does this code work? In this episode you will learn about PHP array functions and replacing out string patterns:
array_search
in_array
str_replace
Break. Go rest your noodle for a couple of minutes.
Episodes
Total Lab Runtime: 02:51:01
- 1 Lab Introductionfree 04:47
- 2 Genesis Markup - Overviewpro 06:55
- 3 Genesis Markup - genesis_parse_attrpro 14:12
- 4 Granular Customization with genesis_parse_attrpro 13:13
- 5 Genesis Markup - genesis_attr - Part 1pro 16:44
- 6 Genesis Markup - genesis_attr - Part 2pro 11:31
- 7 When should you use genesis_markup?pro 15:05
- 8 How does Genesis know to use HTML5?pro 04:35
- 9 Building the HTML5 with genesis_markuppro 08:15
- 10 Markup Helpers for Empty Class and Accessibilitypro 08:50
- 11 Practical Customization Example - Grid Classespro 11:12
- 12 Practical Customization Example - Figuring Out the First Column in a Rowpro 09:47
- 13 Genesis Structural Wrap Overviewfree 07:42
- 14 Genesis Structural Wrap Code Overviewpro 16:24
- 15 Swapping Old Contextspro 09:37
- 16 Refactoring the Swapping Old Contexts Codepro 06:00
- 17 Configuring Structural Wrapspro 04:54
- 18 Wrap it Upfree 01:18