Problem: Client needs to be able to add/edit sidebar content from the Page content editor.
Solution: Secondary HTML Content plugin creates a second content editor right below the main text editor. So my client can just add/edit text in the second editor and it’ll show up in the sidebar. It’s pretty damn cool!
I uploaded the plugin and set settings under Settings. Then created 2 new files:
- A new Page template: tpl-Secondary-HTML-Content.php
- A new Sidebar template: sidebar-Secondary-HTML-Content.php
I also registered a new widget in the includes/register-widget-zones.php file for the Secondary HTML Content sidebar. Then, under Widgets, I dragged the Secondary HTML Content widget to the Secondary-HTML-Content sidebar template.
Note: Embedding YouTube video code into the Secondary HTML Content editor:
- Problem: Secondary HTML Content plugin doesn’t include a HTML view in the editor, so I couldn’t embed YouTube code.
- Solution: Install TinyMCE Advanced plugin and drag the HTML button to the toolbar. A small HTML button will now be displayed as part of the Secondary HTML Content editor.
Secondary HTML Content plugin description:
Add up to 5 blocks of HTML content to WordPress pages and posts. A perfect solution for layouts with distinct content “blocks,” such as a sidebar or multi-column view. When editing content, the secondary WYSIWYG content editors will appear beneath the standard content editor.
You can choose to add up to 5 new HTML blocks to pages and posts independently. For example, you could have no extra post blocks, and 3 extra page blocks. With pages, you can optionally inherit secondary HTML content from the page’s ancestry (parents, grandparents, etc). Perfect for section-wide sidebars.
Secondary content can be used by added to the theme by using the new widget (“Secondary HTML Content”), or by calling the content via a function in your template. See “Installation” for guidance on using the function.