In this episode of Ask Tonya, a Genesis framework user wants to know: How do I increase the Posts Page title’s font size in a Genesis child theme? Specifically, he’s using Infinity Pro by StudioPress. However, the techniques and strategies that I will show you are for any theme.
It’s time to write the code to turn on the editor in the back-end for the Posts Page. You’ll walk through the steps, step-by-step, and discuss how to write the code.
Let’s talk about the architecture and intent. While you could build a home.php or page_blog.php template, this plugin is portable and modular. It allows you to move it from project-to-project without having to change the theme. It uses the built-in WordPress editor, which your client is used to using. We are not using a widget because widgets are cumbersome for clients. A widget does not have the editor interface. It’s not as intuitive for the site owner to figure out where to put content when you use widgets instead of the page itself.
Let me introduce the lab to you to what you will be building. Out-of-the-box for the page that is specified as the Posts Page, which is done via Settings > Reading, the editor is disabled. Why? Because WordPress does not load any content the user puts into this editor. That means whatever your client types in that editor is not rendered (sent out to the browser to display). In this lab, you will build a plugin that turns on the editor and then renders it out to the screen.
There is a difference between the WordPress functions is_front_page() and is_home(). The state of these functions is determined by how you (or your client) configures the site in the Settings > Reading section (in the back-end). In this lab, you will see how different settings can cause a different set of states.
Let’s see the difference. You will explore what the different states are based on the settings in Settings > Reading. You will also learn the intent of these functions. The Posts Page is always going to set the is_home() to true. However, is_front_page state is determined by which page is assigned to be the front page, i.e. a static page or the Posts Post. Let’s see how this works.
In WordPress, these two functions can be confusing. They are identifying if the current web page request is for the front page or the Posts Page. Let’s get you setup and ready to do this simple lab. Just follow along with the instructions.
Out-of-the-box WordPress does not provide a way to introduce the Posts Page (Blog), as the editor is turned off and there is no automatic rendering of the content before the posts. In this lab, you will build a Blog Intro real-world, custom plugin which provides an introduction or welcome feature for your clients. As you build this plugin, you are learning about fetching content from the database, sanitizing, the Genesis framework, views, and more.
Congratulations! You just built a custom real-world WordPress plugin. You did from scratch. While you can use this plugin for all of your projects and even extend it, this lab gave you so much more. You learned some of these valuable coding knowledge: Custom plugin – writing it from scratch Unregister callbacks Investigate a theme Genesis Sanitizing Views Database Clean code Software principles All of these, especially the last two, are essential to you as a software developer. This lab gave you knowledge and skills that you will use in everything you do. It is adaptable then to all of […]
Let’s talk about how I knew to use after_setup_theme. You will look at in WordPress Core.