Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Turning on the Adjacent Entry Nav – Previous and Next
Lab: The Loop Part 2 – Developer’s Guide to Customizing Genesis
Video Runtime: 10:09
After the article, you want to give readers the ability to discover more content easily and quickly. One technique is to use the Previous and Next links which allow the reader to navigate to the adjacent content. Genesis provides the functionality to use these links, but it is not enabled. Nope, you need to turn it on in your child theme. This episode walks you through two different ways to turn on it, as well as you will walk through the code.
Note: The comment in the DocBlock of Genesis says to use a priority of 10 or less to enable the component. I’ll show you that does not work. Instead, you need to use a 9 or less or the alternative method. Here is the code you will use in this lab:
//add_action( 'genesis_after_entry', 'genesis_prev_next_post_nav', 9 ); | |
add_action( 'genesis_before_while', 'genesis_sample_loop_setup' ); | |
/** | |
* Setup the loop. | |
* | |
* @since 1.0.0 | |
* | |
* @return void | |
*/ | |
function genesis_sample_loop_setup() { | |
if ( is_single() ) { | |
genesis_prev_next_post_nav(); | |
} | |
} |
You can use this code to view what is pre-registered to the genesis_after_entry
event:
add_action( 'genesis_after_entry', 'explore_event_registry_table', 1 ); | |
/** | |
* Let's look at the event registry table for `genesis_after_entry` | |
* to discover what callbacks are pre-registered to it and in what order. | |
* | |
* @since 1.0.0 | |
* | |
* @return void | |
*/ | |
function explore_event_registry_table() { | |
global $wp_filter; | |
d( $wp_filter['genesis_after_entry'] ); | |
} |
You get WET when you swim. Stay DRY when you code.
Episodes
Total Lab Runtime: 02:28:53
- 1 Before Entry Content Hook - genesis_before_entry_contentpro 07:13
- 2 Entry Content Overviewpro 05:49
- 3 Entry Content - Post Imagepro 10:43
- 4 Real Refactoring Examplefree 10:46
- 5 Entry Content - Post Contentpro 12:16
- 6 Entry Content - Post Content Navigationpro 13:31
- 7 Entry Content - Post Permalinkpro 09:35
- 8 After Entry Contentpro 04:16
- 9 Entry Footer - Overviewpro 07:14
- 10 Entry Footer - Post Metapro 14:07
- 11 After Entry - Overviewpro 06:01
- 12 Reorder Author Box & After Entry Widget Areafree 08:25
- 13 After Entry Widget Areapro 11:30
- 14 Turning on the Adjacent Entry Nav - Previous and Nextpro 10:09
- 15 Customize the Previous and Nextpro 06:25
- 16 After the Loop - Archive Posts Navigationpro 07:26
- 17 The Loop Else - No Posts Foundpro 01:31
- 18 Wrap it Upfree 01:56