Secondary HTML Content is a WordPress plug-in that adds up to 5 additional HTML content blocks to your pages andposts, making it easy to facilitate sidebars and multi-column layouts!
Major update, version 2.0, released March 11, 2010!
Download version 2.0 from the WordPress plug-in repository »
Description
Add up to 5 blocks of HTML content to WordPress pages andposts. 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.
Installation
- Install easily with the WordPress plugin control panel or manually download the plugin and upload the extracted folder to the `/wp-content/plugins/` directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Optionally configure with the new “Secondary HTML” menu option under “Settings”
- Start entering secondary content! Output using the widget by going to the widget menu under appearance, or use the `get_secondary_content()` and `the_secondary_content()` functions in your template!
Using the Functions
Both functions take 2 optional parameters: block number, and post ID. If no block number is specified, it will default to the first secondary content block (value of 1). If no post ID is provided, it will default to the current post. Consistent with standard WordPress conventions, get_secondary_content() will return the value for the content block, while the_secondary_content() will echo it.
Example: the_secondary_content();
Outputs the current pages first additional content block.
Example: the_secondary_content(2,22);
That will output the the second additional content block for page/post ID 22.
Screenshots
Video Tutorial (for version 1.0) by WordPressModder
As always, feedback and suggestions are welcome!



Great! I recently designed a site with two columns of content. Text on the left and Photos on the right. Side bar is in the footer. The client needs a very visual dashboard and I think I can make this work. One request: can you add the Upload/Insert media icons to the Secondary HTML pane? Pretty minor, huh?
Being a designer and not a coder, I had to get assistance to understand how to implement the code on page.php. But I got there. Thanks.
Please inform me when you add the feature to Posts.
Ken – we’ll be incorporating media buttons as well as an option to add to posts in a forthcoming update. In the interim, for media, you can insert it in the regular HTML area and cut and paste it into the Secondary HTML Content block.
Hi
This looks interesting!
If I understand this correctly, your plugin provides a page- (and soon post-)wise sidebar widget. One just have to add one widget in the widget panel – and then get the possibility to have different content in the sidebar of different pages (/posts) – right?
A postwise possibility and a header (which preferably allows html) would be great!
Thanks,
Kjetil
Kjetil – that’s the idea. We’ll be adding an option to add it to posts. You’ll also be able to a global heading for the widget (i.e. “Additional Thoughts”). If you want unique headings on each page / post, just put a heading in the HTML content area. If you open up the second toolbar (the “kitchen sink”), there’s a heading format drop down.
Hi, i downloaded the plugin and activated it, i opened the widgets and dragged it to one of my side-bars BUT i get this ”There are no options for this widget.”
what do i do ?
I have the latest WP which is 2.8.5
[...] Secondary HTML Content [...]
Ahmad – The widget itself has no options. You need to add Secondary HTML Content to any page using the new panel. It will show up in the widget when those pages are display!
Great
Thanks for clearing this up
- and keep up your good work!
Plug-in is amazingly handy. A few questions/recommendations/suggestions:
1) Permalink compatibility(doesn’t seem to work on my site, the automatic call of the secondary-content associated with the post)
2)Edit Page seems to load quite a bit slower with this plug-in activated, is there any way of speeding up this load time? [same on local server as external server]
Obviously neither of these is a deal-breaker, the plug-in is amazing and makes extra content extremely easy for un-familiar users to input.
Thanks!
Never mind on either count. I was spacing a few things. I would be excited for the addition of media buttons, can’t wait for the update.
This plugin sounds great but I am having a little difficulty with it. Please forgive me, I am a designer and not a programmer.
After installing it and activating it in the plugin menu, I get the new HTML box appearing in my posts and pages. However, when I enter text into the box, it does not appear on the page. I see that I am supposed to use the function `the_content_2()` or `get_the_content_2()`. Only I am not quite sure how to do that. Any advice would be greatly appreciated!
Thanking you in advance!
Mark – I’ve added a video tutorial put together by WordPressModder that might help you out. The easiest way to get them to show up is to go to “Widgets” under “Appearance” and drag and drop the “Secondary HTML” widget into a sidebar, where you want it to appear.
This is great. I need this for a site I just did http://thepastures.net/ but I hit some bumps that might be useful to cover. As you see, I have two content areas; the left hand TEXT column and the right hand IMAGE column. Currently I am using CSS to move the Images to the right. I need to keep this simple for the client and having the secondary content pane in the dashboard will be a big help.
First, I am a designer and not a programer so I needed some help getting the code into my php templates. I did get everything to work for Pages on my test site: http://kennethbsmith.com/clients/wp01 (this is a WP test site for me, so the content is different, but I hope you can see that the style and functionality are the same as the client retreat site)
I used this class:
.rt400{
width: 400px;
margin:0 35px 0 0;
text-align:center;
float:right;
border:1px dotted red;
}
and inserted this into pages.php, index.php and single.php
Everything is working except on NEWS (the Home Page for the Posts.) I this clear?
With help, I revised index.php using
ID ); echo ‘‘.$post->ID.’‘; ?>
So, I am not getting the secondary content for the posts on the Home page.
What do you suggest?
Let me know if I need to explain this in more detail or offer more information.
Thanks
Unfortunately my code is not appearing in the comment I just made. What should I do to show you the html and php code I am using?
[html]
ID ); echo ‘‘.$post->ID.’‘; ?>
[/html]
Hey Ken – sorry for the belated response.
I know what the issue is, and will try to release an update next week that supports your use case.
The fundamental issue is that WordPress does not treat the “posts page” as a true page. It’s treated as a container for the posts index. But I can work around it with some clever coding.
This is a very good plug-in, flexible easy to understand and works well with my multiple sidebar configuration. I would like to congratulate you on an excellent effort!
hi, i am implementing a secondary sidebar on my site, i was wondering if this widget can be made for multiple instances, so that i can use it more than once on my multiple sidebars? thank you!
The text color is white when I try to type in the secondary HTML content box… How in the world am I supposed to see what I’m typing?
Matt – it’s not doing that in our testing environments and no one else has reported that yet. Do you have any plug-ins installed thy also modify / use the editor? If you open up the “kitchen sink” toolbar and look at the font color, is it set to white? Are you running 2.8.x? A complex theme?
Joseph – we’ll target multiple instances for the next update.
I have the following problem:
I have installed the plugin and activated it.
In the header-template I putted .
I get only the text of the “normal” page (2 times).
See: http://www.restaurant-riethoeve.nl/vankeulen/?page_id=118
What i’m doing wrong? please help!
Regards,
Geert van der Heide
@geert: i have the same problem…i didn’ understand where put the code….i have tryed to put it in my template but i have my second content twice.
Geert / Takingweb – you need to put the function “the_content_2()” inside a PHP code block. For instance:
< ?php the_content_2(); ?>Jake-
Any ETA for the POST PAGE fix?
(JG: I know what the issue is, and will try to release an update next week that supports your use case.
The fundamental issue is that WordPress does not treat the “posts page” as a true page. It’s treated as a container for the posts index. But I can work around it with some clever coding.)
Why not just make the plugin so that you can replicate the html box as many times s you want and call it as many times as you want??
A suggestion and a problem here.
First, the suggestion: it would be awesome to be able to insert php code and not only html.
And the problem is that when i upload a picture to the media manager and try to insert into the post area, it always automatically insert it on the secondary html area. Any way to resolve it?
Thanks for the plugin, it’s a great idea
Ken – sorry for the delay, we’ve been really swamped since WordCamp! Will try to knock it out this weekend in a free moment.
Robert – I suppose we could build a plug-in that facilitates that as well, but from an engineering perspective, the more complicated you make the plug-in, the more overhead it’s going to place on the site.
I think 95% of those looking for a multi-block solution just want 2 columns (I can’t think of many designs that have more than 2 blocks unique to a given page). So the thinking was to focus on making a plug-in highly optimized for that situation.
That said, there’s no technical barrier, and an ability to specify the number of blocks you want to use (or letting someone add multiple ones on the fly) is something we’ll put on the road map.
If anyone (you or otherwise) wants or needs that feature and is willing to sponsor it before we “get around to it” (that’s the way it works with freebies), let me know and we can fast track it!
this is great! thanks so much for this plugin!
my client wants a “related links” for every article and he wanted it to be posted on the sidebar and this plugin saved me from writing my own!
Hi… I hate to be a nag but I’ve encountered the same problem as Antonio. Whenever I upload an image and insert into the post, it will automatically insert into the secondary content.
The uploaded image doesn’t appear on the post’s gallery as well. I had to grab the links from ‘media manager’ as if the media is attached to other post.
I’m using WP 2.8.6, your plugin version 1.5. Tested both on Chrome 3.0.195.33 and FF3.5.5, running on Win XP.
Thank you so much!
It’s exactly what I need and looked for. Thank you for this great work.
I’m on WP2.8.6 and whenever i enter something into the secondary content panel, it saves fine. If i then go back to edit the page, all the formatting ( tags ) are lost.
Any ideas?
When I installed qTranslate plugin with the Secondary HTML plugin, the text disappeared in the post / page editor.
From their site:http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=294
qTranslate tries to modify every String it can get its hand on, but unfortunately, custom Plugins often don’t supply filters nor use Gettext for their Strings, so it is impossible for qTranslate to filter out the correct language.
It would be great if I could use your plugin with qTranslate. I don’t know enough about PHP to make the small changes myself.
Jonathan – can you explain the “disappeared” comment a bit more? The text in the secondary HTML block disappears?
Getting a bit technical here, but we apply the same filters to secondary HTML that are applied to the regular HTML block on save and output. Those include shortcode processing.
I’ll try and find some time to look into general shortcode handling with secondary HTML content, but can’t really invest “free” time in compatibility with a single plug-in. If this is a priority, and you have a budget, you could certainly “sponsor” full qTranslate support. If you’re interested, contact us.
Would I be able to create more “HTML Content Boxes”? For example, with this plugin by placing “the_content_2()” I get a second “Content Box”. If I were to place “the_content_3()” would I get a third “Content Box”?
This would be great for pages that have alternating 2, 3, 5, or even 10 columns of text. One could add as many separate text boxes of static text as needed.
This plugin is so close to being a perfect answer for me. Thanks for all your work! I’m glad that you can code PHP. I wish I could.
Adam – this plug-in only enables a second content box. While we could write a plug-in enabling unlimited boxes, we saw that as a rare use case (few sites have more than 2 unique boxes per page) and didn’t want to add more performance reducing overhead to the plug-in.
It’s certainly feasible to do that, however.
Thanks for releasing this plugin – like many here, it’s something I need for the site I’m creating. I’m a bit confused, forgive me, but is there some way to only have the two content boxes appear on one page?
I only need the two content boxes to display on the home page, but when I activate the plugin, the two content boxes display on all the pages.
I’m using WordPress as a CMS, no posts, only Pages.
Hi, This plugin was just what I needed for my theme, but (and you knew there’d be a but!) is there any way to get a an excerpt from it? The regular WP get_excerpt only seems to know about the main html window, and I need to draw my excerpt from your secondary window…
In PHP code:
echo apply_filters('the_excerpt',get_the_content_2());that’s great! Thanks Jake- quick reply!
Now, to limit the number of characters?
OK I think I’ve answered my own question: I borrowed a function from bavotasan.com and modified it to apply to content_2() rather that content():
function content_2($limit) {
$content_2 = explode(' ', get_the_content_2(), $limit);
if (count($content_2)>=$limit) {
array_pop($content_2);
$content_2 = implode(" ",$content_2).'...';
} else {
$content_2 = implode(" ",$content_2);
}
$content_2 = preg_replace('/\[.+\]/','', $content_2);
$content_2 = apply_filters('the_content_2', $content_2);
$content_2 = str_replace(']]>', ']]>', $content_2);
return $content_2;
}
and now in my templates I just call:
where 40 is the mumber of words I want to display.
Seems to work a treat!
and now in my templates I just call (inside php code):
echo content_2(40);
where 40 is the mumber of words I want to display.
Hi,
Just found an issue with the plugin in the function get_the_content_2(). Somehow the content was not shown. On line 124 it says:
if(is_null($post_id)) {
change this line to:
if (empty($post_id)) {
and it works again!
Hello, I added this to plug-in folder and it does not show up to allow to activate? I am using WP 2.9.2
Sorry, I am a WP newbie! OK, I have plug-in showing up and installed
I have found a bug with image insert, however. When the second HTML box is selected. That is cursor is in place to where I want image inserted…. The image inserts into first box instead?? Maybe have a copy of the upload/insert icons above the second HTML box that will be for that box only.
Thank you.
Jake,
Great plugin and I have a quick question. Is there a way to make the secondary html content appear on its respective page and/or post without any other sidebar content appearing?
Thanks,
Drew
Drew – not sure I understand the question. You have a widgetized sidebar, and you want to disable all widgets except the secondary HTML from appearing? If it’s only for a few pages, consider the Widget Logic plug-in. Otherwise, you could edit your sidebar to do something like
if (get_the_content_2()) {
the_content_2();
} else {
//code to output normal sidebar goes here
}
Sorry for being unclear and thank you for your patience. I mean that I only want the secondary html content to appear and not any of the other sidebar elements.
I’m guessing that is done by editing the page php template with the function code. If so, could you offer a little insight on exactly what code to enter in the template?
Ideally, I’d love to create a dedicated full width template with the necessary function code, add that to my custom templates, and then just select from the templates when creating/editing pages.
Many thanks!
Hi great plug-in but do you think it’s possible to only have the secondary html appear only on certain pages. I’m making a winery website and this would work great for the tasting notes pages. I think it would be confusing for the client to have it appear on every edit page/post (frog cms have something similar to having that option). Is there a way I can customise this to make this possible? Or if it’s easier I can pay you to make this alter for me.
[...] Secondary HTML Content (WordPress plug-in) « C. Murray Consulting. [...]
hi – thanks for the awesome plugin!
some notes: image insert pastes into default post editor (wordpress default editor)
when it does this, it removes the path the image leaving ../files/ etc.
is there any way to patch this?
To those of you asking about multiple content blocks and better support for media buttons — wish granted.
Hi, I wonder if it is possible to add content blocks to a specific place in the theme -ACCORDING TO a specific custom value given?
Jake, thanks for doing this!
I have a question about upgrading. Is there a preferred way to upgrade from the old version to the new one?
I installed the new one and lost all of Secondary HTML Content that had been there before. Well, it’s not lost – it’s still in the database as “_content2_textarea” while the new version of the plugin expects “_secondary_content”. I can rename these in the database, if needed, but I was wondering if you had a better way.
Ah, in the ReadMe it says “The pre-2.0 function calls are backwards compatible, and the plugin will upgrade your custom fields. If you are using the widget, you may, however, need to re-add the widget due to fundamental changes to the widget’s configuration and setup.”
I must have done something wrong! I’ll dig.
Is there any way to name sections? it would be really good if we could then it would be clear which section adds content to what.
John – it’s certainly possible with some basic theme code that uses the functions documented here. If you’d like help, use the “Request a Quote” button. We often help (via our consulting services) with custom or special implementations of our plugins.
For those curious, Bill’s issue had to do with uploading the plugin directly and using it as a sitewide MU plugin. The custom field names are upgraded upon “activation”. The built in WP upgrade will de-activate before upgrade and re-activate upon completion.
I may add this in a future version.
Hi. I really like how the media buttons have been added to the secondary block. I tried to do this to main content block. And it worked. But then when I activate the secondary block, the media buttons moved to the secondary block. Is there anyway to have the media buttons appear on both main and secondary blocks?
Adam – I’m sure there’s a way. The API functions for the editor are fairly rich. That said, I don’t have enough information or a clear enough sense of what you did to advise further. We generally ask that special support requests outside of plugin support be made using the “request a quote” button.