This plugin is for the Insert Content from Editor into Blog Page Lab on KnowTheCode.io.
Introduce Your Blog Page - Add an introduction to the site's blog page using the WordPress editor on the page_for_posts page.Introduction your blog (page_for_posts) page to your audience.
Out-of-the-box WordPress does not display the contents on the page set for page_for_posts (set in Settings > Reading and static > Posts page). The editor in the admin area is disabled for this reason.
This plugin and lab walks you through how to:
- Build a custom plugin
- Enable the editor on the Blog post
- Get the contents from the database
- And render (display) the contents on the front-end
- The plugin is currently configured for the Genesis framework, but could easily be adapted for any theme.
- If you use this plugin on another theme, you will need to make some adjustments with the events, particularly
genesis_before_loop
, which is used to trigger the render callback.
You could easily take this plugin and place the functionality into the home.php
template with your theme. The intent with this lab is to show you how to build more modular code that you can port from project-to-project without having to copy/paste into the theme itself. However, the choice is yours where you want to put the functionality.
The editor gives much more flexibility. Clients are used to the editor. It allows them to style and set their content the way they want without having to know HTML or CSS.
This plugin includes the following features:
- Composer - Dependency Manager for PHP
- Kint - Awesome package that helps you to debug - forget
var_dump
andprint_r
. You are going to love Kint. - Whoops - Oh man, you will wonder why this isn't built into PHP. When an error occurs, this displayer replaces out the PHP orange table and gives you information you can actually use.
- Download it.
- Put into your
wp-content/plugins/
folder - Extract it
- Go into the new folder
- Run
composer install
in terminal to bring in the dependencies and install Composer locally.
Installation from GitHub is as simple as cloning the repo onto your local machine. To clone the repo, do the following:
- Using PhpStorm, open your project and navigate to
wp-content/plugins/
. (Or open terminal and navigate there). - Then type:
git clone https://github.com/KnowTheCode/WordPress-Starter-Plugin-Lab
. - Go into the new folder
- Run
composer install
in terminal to bring in the dependencies and install Composer locally.
All feedback, bug reports, and pull requests are welcome.