Genesis provides you with an event where you can add content between the entry-content and entry-footer HTML markup areas. To use this event, you will register your function (callback) to the event name genesis_after_entry_content. In this episode, you’ll see where to use it and where the content would occur with the HTML markup on the web page in the browser.
Labs are hands-on coding projects that you build along with Tonya as she explains the code, concepts, and thought processes behind it. You can use the labs to further your code knowledge or to use right in your projects. Each lab ties into the Docx to ensure you have the information you need.
Each lab is designed to further your understanding and mastery of code. You learn more about how to think about its construction, quality, maintainability, programmatic and logical thought, and problem-solving. While you may be building a specific thing, Tonya presents the why of it to make it adaptable far beyond that specific implementation, thereby giving you the means to make it your own, in any context.
Entry Content – Post Permalink
What happens on an archive page when a post does not have a title? Did you know that the Genesis framework has a default registered function called genesis_do_post_permalink, which is found in genesis/lib/structure/post.php? What will happen is: Genesis adds the permalink and some HTML markup after the content and post navigation. In this episode, you’ll walk through the function to understand how it works. For the customization exercise, you’ll again use the PHP construct called str_replace() to add some prefix label to the link.
Entry Content – Post Content Navigation
In this episode, you’ll take a look at the Genesis framework function genesis_do_post_content_nav, which is found in genesis/lib/structure/post.php. This function is setting up the arguments which are passed into the WordPress Core function wp_link_pages. The intent of this function is handle in post navigation, i.e. paginated posts. Did you know that functionality even exists? I’m also introducing you to a PHP construct called str_replace() which allows you to swap out parts of a string by searching for a given pattern. As part of your customization hands-on work in this lab, you’ll be replacing the “Pages:” string, which is hardcoded in […]
Entry Content – Post Content
As part of the entry content, Genesis has a default registered callback for building the content based upon various settings (who you have it configured) and which web page is being displayed. The function is genesis_do_post_content, which is found in genesis/lib/structure/post.php. Looking at the function, you’ll see that there are four (4) different conditionals to determine what content is displayed: the web page is a single piece of content, i.e. is_singular() is true “excerpts” are set for the archive (because it’s configured that way in Genesis > Theme Settings) the archive content is being limited (because it’s configured that way […]
Real Refactoring Example
Even though I use and like Genesis doesn’t mean there aren’t areas where it doesn’t fully comply with clean, quality coding techniques. In the last episode, I showed you the code for processing the post image. Did you notice that the code within the function genesis_do_post_image() will not run (none of it) if the conditional expression is not true? Ah, this is a perfect example of when to return early. Return early pattern: when you are done processing and nothing else in the function/method is going to be processed, then so bail out and return early. Why? Why would you […]
Entry Content – Post Image
As part of the entry content, Genesis has a registered callback for building the post image. The function is genesis_do_post_image, which is found in genesis/lib/structure/post.php. By default it is set to a priority of 8, meaning it fires first before the content. The post image will go out to the browser if: this is not a singular page, i.e. is_singular is false, the option for the featured image is checked in Genesis > Theme Settings > Content Archives, and the article has a featured image. The magic of this functionality occurs within the Genesis helper function, genesis_get_image(). Let’s walk through […]
Entry Content Overview
The entry content is built and rendered out to the browser using the Genesis event hook called genesis_entry_content(), which is found in genesis/lib/structure/loop.php. Within the Genesis framework, this event has multiple callbacks registered to it in order to build the different elements of the entry content: Post image Post content Post content navigation for paginated posts Post permalink (for when there’s no title) You can use this event to reorder, remove, or add various elements. It gives you the means to customize what you want to be rendered within the <div class=”entry-content”> section of the page.
Before Entry Content Hook – genesis_before_entry_content
Genesis provides you with an event hook called genesis_before_entry_content(), which is found in genesis/lib/structure/loop.php. This event is available to you to a couple of different customization use cases: Rendering out content which is not part of the article’s (entry) header or content, e.g. social media buttons Pre-processing or preparation (prep) work before you do the entry content This particular event is fired in the loop within Genesis, but is not used anywhere else in the framework (at the time I recorded this). It’s there for you. It gives you a hook for customization.
The Loop Part 2 – Developer’s Guide to Customizing Genesis
This is the second part of the Loop. In this lab, you will explore how the remaining portion of the loop in Genesis works as well as how to customize it. You will dig into the entry content, footer, and after entry components.
Entry Header – Post Info
Within the entry header, Genesis provides the means for each article to have additional information. They call it the byline as well as post info, as it provides additional information about this particular article. Let’s explore how Genesis builds the HTML markup and what event hooks you have available to you to customize this information. In this episode, you are exploring the genesis_post_info() function, which is found in genesis/lib/structure/post.php.