On a Genesis customization project I worked on today, the requirement was to place links to Previous and Next posts at the top of single Posts and to limit their link text to a set number of characters so they do not appear on two lines. Before: After: Here's one way in which this can be set up in Genesis: We shall duplicate
genesis_prev_next_post_nav()inside genesis/lib/structure/post.php and in this new function replace the calls to
next_post_link_plus()whilst passing our desired number of characters for the max length of links' text. Then inside a function hooked to
loop_startaction we are going to call the above function if the plugin is active, otherwise the standard
Always hook as late as possible.
loop_startis the one that's above
genesis_before_entry, the location where the post navigation is to be displayed. Refer to the visual hook guide.
Step 1Install and activate Ambrosite Next/Previous Post Link Plus plugin.
Step 2Add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.