Let’s go deeper and head into Core to look at get_post. This function is going to either pull the post content from the database or cache. In this episode, you will learn about both and reverse engineer the function to discover when it’s pulling from one or the other. As the function is dealing with the database, it’s time to teach you some SQL. You will play around with the database to see how to pull records. I use Sequel Pro, but you can use phpMyAdmin to do the same exploring of the database. Here are additional resources about PHP […]
Let’s refactor how you are getting the posts page object by abstracting it into a separate, reusable function. Then you’ll add in protection to ensure an object is received back from the database before continuing the processing. You will be learning about clean, quality code in this episode too. You will learn about the Falsey Conditional Expression.
Let’s go into WordPress Core and talk about how is_home() works. You will also learn about objects and OOP in this episode, as is_home() is a wrapper around the instance of WP_Query. You can also see this hands-on lab to learn the differences between is_home and is_front_page:
You only want the contents to display (render) on the Posts Page and that’s it. In this episode, you’ll learn how to ensure you are on that page. If no, then return early and stop processing; else continue with the rendering. You will learn about clean, quality code too. You will learn about is_home.
Let’s get the contents out of the database and then display (render) it onto the page in the browser. You’ll walk step-by-step through the process. You will learn about get_post.
Let’s dive deeper into the Genesis framework by StudioPress. You will learn about: the posts page archive rendering Genesis markup and genesis_attr – overview and intent HTML attributes
Let’s figure out where we can hook into the theme to add the content from the editor. Each theme will be different. You will need to evaluate your theme in order to determine where you can hook into for rendering out the content. In this episode, you will look at two themes. First, you will dive into the Genesis framework and look at where the page title is being rendered for the Posts Page, i.e. found in genesis/lib/structure/archive.php. You will see which event you need to register to in the plugin in order to add in the content. Then you […]