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

  1. Install easily with the WordPress plugin control panel or manually download the plugin and upload the extracted folder to the `/wp-content/plugins/` directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Optionally configure with the new “Secondary HTML” menu option under “Settings”
  4. 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!

142 Responses to “Secondary HTML Content (WordPress plug-in)”

  1. Ken says:

    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.

  2. Ken says:

    Please inform me when you add the feature to Posts.

  3. Jake Goldman says:

    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.

  4. Kjetil says:

    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

  5. Jake Goldman says:

    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.

  6. Ahmad Al-Saffar says:

    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

  7. Jake Goldman says:

    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!

  8. Kjetil says:

    Great
    Thanks for clearing this up
    - and keep up your good work!

  9. Jesse says:

    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!

  10. Jesse says:

    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.

  11. Mark says:

    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!

  12. Jake Goldman says:

    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.

  13. Ken says:

    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

  14. Ken says:

    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?

  15. Ken says:

    [html]

    ID ); echo ‘‘.$post->ID.’‘; ?>

    [/html]

  16. Jake Goldman says:

    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.

  17. Joseph says:

    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!

  18. Joseph says:

    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!

  19. Matt Rittman says:

    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?

  20. Jake Goldman says:

    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?

  21. Jake Goldman says:

    Joseph – we’ll target multiple instances for the next update.

  22. Geert van der Heide says:

    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

  23. Takingweb says:

    : 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. :(

  24. Jake Goldman says:

    Geert / Takingweb – you need to put the function “the_content_2()” inside a PHP code block. For instance:

    < ?php the_content_2(); ?>

  25. Ken says:

    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.)

  26. Robert says:

    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??

  27. antonio says:

    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

  28. Jake Goldman says:

    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!

  29. mrbee says:

    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! :)

  30. mrbee says:

    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! :)

  31. Dietrich says:

    It’s exactly what I need and looked for. Thank you for this great work.

  32. Phil says:

    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?

  33. Jonathan says:

    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.

  34. Jake Goldman says:

    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.

  35. Adam says:

    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. :)

  36. Jake Goldman says:

    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.

  37. Lee says:

    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.

  38. Nick says:

    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…

  39. Jake Goldman says:

    In PHP code:

    echo apply_filters('the_excerpt',get_the_content_2());

  40. Nick says:

    that’s great! Thanks Jake- quick reply!
    Now, to limit the number of characters?

  41. Nick says:

    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!

  42. Nick says:

    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.

  43. Eds Keizer says:

    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!

  44. Roger says:

    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

  45. Roger says:

    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.

  46. Drew McManus says:

    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

  47. Jake Goldman says:

    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
    }

  48. Drew McManus says:

    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!

  49. Nola says:

    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.

  50. [...] Secondary HTML Content (WordPress plug-in) « C. Murray Consulting. [...]

  51. Laurence says:

    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?

  52. Jake Goldman says:

    To those of you asking about multiple content blocks and better support for media buttons — wish granted. :-)

  53. John says:

    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?

  54. Bill Dennen says:

    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. :)

  55. Bill Dennen says:

    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.

  56. slee says:

    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.

  57. Jake Goldman says:

    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.

  58. Jake Goldman says:

    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.

  59. Jake Goldman says:

    I may add this in a future version.

  60. Adam says:

    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?

  61. Jake Goldman says:

    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.

  62. Victor says:

    Hello,
    just wanted to give you my kudos for this great plugin. Thank you!

    Best regards / Victor

  63. Giuseppe says:

    Hey guys, first off thanks for the great plugin. Just a couple of issues I’m having with it.

    Firstly I think someone has already mentioned that the content area tends to drop tags on save if you type the HTML in yourself.

    eg.. If I hit the HTML button and go into the html editor and type

    This is a title
    this is the first paragraphAnd this is the second paragraph

    When I save from inside the HTML window the visual editor will display the changes correctly.. but upon updating the wordpress page.. the second paragraph is lost.. resulting in :

    This is a title
    this is the first paragraph. And this is the second paragraph

    Secondly, I’m having a problem getting my secondary content to appear on my index page. It’s working perfectly on page.php simply using
    inside the loop.

    $main_query = new WP_Query(‘pagename=’.$slug);

    While ($main_query->have_posts()): $main_query->the_post(); ?>

    but for some reason it doesn’t want to work on my index page, the only difference I can see is in my query..

    $get_index = new WP_Query(‘page_id=1343′);

    the rest of the code is near enough identicle.. so just wondering if there are any bugs you guys know of that might be causing this?

    Thanks,
    Giuseppe

  64. Giuseppe says:

    Sorry, I didn’t realise this would delete the HTML tags haha, basically.. if you use two sets of paragraph tags.. the second set will be lost on update and the result is that all of the text ends up being wrapped in a single set of paragraph tags..

    Cheers guys

  65. Stefan Matei says:

    I’m noticing some issues with the formatting. More specifically, I had a couple of paragraph tags and each had a br tag inside. After saving, all content is stored as it should, but when editing that post/page again it all shows up in one line.
    I’m running WP 2.9.2.

  66. beheader69 says:

    haven t u managed to include it in the home page, as u said earlier?

  67. beheader69 says:

    i linked secondary content to a post, but i want to show it on all pages…how do I do that?
    i mean how do i get the content from db?

  68. Bruce Stevenson, ABC says:

    Thank you. Well done, easy to implement and seamlessly integrated. Truly takes WP up a notch as a CMS.

  69. Eric says:

    This is a great plug-in!!

    I just have 1 problem that I hope someone can help with. I am running into a brick wall trying to get this to work on the “Home” page. Do I need to add something to my template’s index.php somewhere?

    Thanks so much in advance!!

  70. Jake Goldman says:

    Giuseppe – I’ll look into the P tags issue. Probably should reveal the WordPress code editor instead of the pure HTML editor. WordPress has it’s own way – via sanitizing – of realing P tags and line breaks.

    As to the output, how are you showing the secondary blocks? Are you doing it via code (please show) or using the widget?

  71. Jake Goldman says:

    Stefan – the issue is that the true HTML editor I reveal doesn’t gel with the WordPress sanitizing of the content. I’ll probably sub the HTML button for a tab a la the first block.

  72. Jake Goldman says:

    Beheader – I’ll need you to be a lot more specific about how you’re trying to use the plugin. Try the included instructions.

  73. Jake Goldman says:

    Eric – it can be used on the home page just as you would on any other page if your home page is set up as a static page under WordPress reading settings.

  74. Ron says:

    I am SO thankful for this plugin. And I have a question: is there a way to pre-set an HTML container that the content is written within? I’ll tell you what I’m trying to do.

    In one template that I’m using, all of the widgets are placed each in it’s own DIV with class ‘block’. (The styles depend on this.) However, when I put content into the plugin, it places is with an ID or Class, so I can’t target it easily. So, I’d like to put in the ‘before’ and ‘after’ parameters, if there are any. Is this possible?

    Example: The plugin knows to place the content at the top of the container. In the template I’m using, each widget is inside a child DIV with class “block”.

    (I hope the HTML example I put in here does not get stripped out. There is no Preview on this comment feature.)

  75. Terri says:

    This is a great plugin. I really appreciate your hard work. But, would you please take a look at this page http://jesse.carissarichards.sgradsite.com/guestbook/, and tell me what I can do to remove the guestbook from the sidebar?

    This may not be your plugin that is causing the problem, as I cannot even see this content in the Secondary html content editor, but maybe there is something I can work on in the editor?

  76. veker says:

    it can be used on the home page just as you would on any other page if your home page is set up as a static page under WordPress reading settings.

    but i don’t kown how it
    please give me one index.php files?

    thank you!

  77. Kevin says:

    I am integrating the_secondary_content() into a filter for ‘the_content’ and there’s a conflict.

    add_filter(‘the_content’, ‘my_subpages’);

    So, I simply changed the plugin code around lilne 183

    From:
    return apply_filters(‘the_content’,$content_textarea);
    To:
    return apply_filters(‘the_excerpt’,$content_textarea);

    and it now works perfectly without interfering.

    If anyone knows of a better way to do this w/o altering the plugin at all, can you please let me know? Thanks!

  78. Ron says:

    This morning, while poking around the secondary_html_content.php, I found two variables: $before_widget and $after_widget. Where are the values of these variables set?

  79. Jake Goldman says:

    Ron – if you are using a widgetized sidebar, the before and after parameters are defined when the sidebar is defined in the functions file. There’s documentation on defining the sidebar in the codex.

    If you are adding the function to your file, you can wrap the output any HTML you’d like.

  80. Jake Goldman says:

    Hi Terri – the secondary content has all of the filters applied to it that the primary content does (this is important for retaining styling and doing things like handling media links). You probably have a plug-in that adds a guestbook to your content output.

    I’m thinking about adding some advanced options in the future that enables users to disable some plugin filters, but thats probably a little ways off.

    If you know how to use the filters API, you could probably remove the filter yourself above the output.

    If you need additional, personalized help please use the “request a quote” button.

  81. Jake Goldman says:

    Veker – we provide pretty good documentation and basic support through these comments for free. We are not in the habit of providing personalized support and training pro bono, however. If you need extra or personalized help, please use the request a quote button. Good luck!

  82. Jake Goldman says:

    Kevin – you could remove the filter using remove_filter(‘the_content’,'my_subpages’) somewhere “above” it’s output and then add it back below using add_filter (only necessary if the content outputs after the area where you remove the filter).

    Again, I’m exploring an advanced option in the GUI for selectively removing filters applied to the content.

  83. Ron says:

    Thanks Jake! What I will do is experiment with putting in the function into the sidebar instead of dragging/dropping the widget into a sidebar from the Widgets panel. (Is that what you meant?)

  84. Ron says:

    That worked nicely, Jake. One last question: is there a IF statement that I can use to test whether a secondarHTML block has content in it? (I don’t want the container to be written if there is nothing to put into it.) I had hoped that get_secondary_content() would do that, but it doesn’t appear to return anything.

  85. Jonno says:

    Hi

    I’m just adding my feedback to the already reported problem where the HTML has paragraphs tags and special characters stripped – sanitized as you say :-)

    I notice that, when I have more than 1 paragraph, the paragraph tags are stripped out of the Secondary HTML Content.

    i.e., instead of, say, 2 paragraphs it changes the HTML so that there is only 1 paragraph enclosing the content.

    The plug-in also removes/coverts any special character tags – like quotes marks.

    Any chance this can be fixed? – so that it doesn’t change the HTML in any way. Let the authors be responsible for using correct markup. :-)

    I’m running WP 2.9.2 and usually have the Thesis Theme installed.

  86. Robert S. says:

    Hey Jake,

    Man this is am amazing plugin / feature !
    This should be core to the functionality of WP from basic install if you ask me : )

    I’ve got it implemented on many of my pages containing a sidebar, yet the only page I can not get it to appear on is my BLOG front page. (which is not the WP default ‘home’page).

    My goal is to be able to have a the ’secondary content html’ widget content appear in the sidebar of the Blog homepage How can I do this?

    Is this related to applying the functions site wide? – if so any guidance as to function code implementation would be greatly appreciated

    Robert

  87. Robert S. says:

    Never mind, that last comment Jake, I managed to find this amazing work around:

    http://wordpress.org/extend/plugins/display-widgets/

    Perhaps others will find my querry useful.

    Thank for your brilliant plug in – I certainly will donate if I implement this feature on any commercial sites.

  88. Jan Leeks says:

    This is a great plugin, really simple and very useful and the kind of functionality that the core product could do with, well done.

    I have it working fine on standard pages, but on my posts it doesn’t work when using the exact same principles. Any ideas, im quite simply using the standard call:

    not having any joy

  89. Nick says:

    Just wondering if this is a bug but when I click in the new content area and click the image button at the top to upload an image the image is always placed in the top default content area and I have to move it down. not a big problem I agree

  90. Jake Goldman says:

    Hi Nick – if you’re using the media buttons on the top of the first content area editor, this will happen.

    In the plugin’s settings panel under “Settings” there’s an option for adding media buttons to the secondary content blocks. That should add buttons to the toolbar that will insert the media within the selected boxes.

  91. Nolan says:

    Love this plugin!!!

    Is it possible to get this to work with Custom Post Types???

  92. Catalin says:

    Hi Jake,

    Great usability but stucked with two issues, perhaps you may have solutions already:
    1. whenever save page, seems that formatting is lost – instead of many html paragraph tags there is only one containing all text
    2. search does not work on secondary contents, at least in my case

    Using MU version, maybe this is the cause?

  93. Paul says:

    Firstly, great plugin!

    I’m having trouble getting the secondary content to show up in the right column of the page I’ve assigned a blog to: http://ajbrown.werremeyer.com/news/

    I’ve applied it successfully on other pages: http://ajbrown.werremeyer.com/about/

    In the settings i’ve set 1 as the number of secondary html blocks to add for posts.

    Thoughts?

  94. Mike says:

    Great Plugin! Solves the issue of having my client need to know HTML to add things to there sidebar on a per page/post basis. I do have one question though, Ron asked the same one but I did not see an answer:

    “is there a IF statement that I can use to test whether a secondarHTML block has content in it? (I don’t want the container to be written if there is nothing to put into it.)”

    Any advice?

    Thanks,
    Mike

  95. danixd says:

    First off nice plugin, thanks.

    I have this working in single.php using a custom query, but when I apply the same template to a page it does not work.

    I assume the command is trying to pull information from the pages boxes (which are empty) even though they are inside a query. Not sure how to deal with it.

  96. danixd says:

    Just a quick not to say it didn’t work on page.php or category.php either.

  97. Jen says:

    The problem I’m having is display of social bookmarking buttons twice within the custom page template, once on the_content and once on the_secondary_content. I’ve tried removing the social plugin action on custom_page.php in functions.php to no avail. I’d appreciate any thoughts.

    the social plugin uses
    if (function_exists(‘add_action’)) {
    add_action(‘the_content’, ‘obtextonlysocialbookmarker’);
    }

  98. Erik Weikert says:

    I am trying to remove the wpautop from the secondary content but am not having any lucks. Any ideas on how to get it to work? Thanks!

    Erik

  99. Jake Goldman says:

    The plug-in applies the “the_content” filter (the same one used for regular HTML content) to the secondary content before its output on the page.

    You can remove the wpautop filter on the the_content by adding a line like so to your functions.php file:

    remove_filter('the_content','wpautop');

    Of course, that will also remove the p’s on your regular content.

    If you’re outputting the secondary content using template code (and not the widget), you can always add that line above the code for secondary HTML output, and than re-add the filter below the output.

  100. Paul says:

    Jake Goldman says:
    March 11, 2010 at 10:45 pm

    To those of you asking about multiple content blocks and better support for media buttons — wish granted.

    I was wondering if there is any update on multiple content blocks you mentioned ?

  101. Chaney says:

    I am just now noticing that the media buttons are gone from my second content area. They were there and I do have the “add media buttons” checked. I recently upgraded to wordpress 3, maybe that had something to do with it?

    Thanks

    Chaney

  102. says:

    I love this plugin but I need to be able to able extra content blocks to new custom post types.

    Any advice? Thanks

  103. Sandra says:

    Hi Jake,
    Thanks for the awesome plug-in! Do you know if it works on WP 3.0?
    Thanks!

  104. Jake Goldman says:

    Sandra – it should work well with 3.0, though I hope to release a new version with full custom post type support (in addition to posts and pages) in the near future.

  105. Mas says:

    Hi,

    I have a page template with a div section that shows a post from a category specified in custom field. Got that code from wp codex: http://codex.wordpress.org/Pages#A_Page_of_Posts and pretty much using it as is, with only a slight mod to fit my theme.

    But this code is making my secondary html to disappear. I’m on WP 3.0, and using in my template to show secondary html. Seems like it got something to do with $wp_query, but I’m no php expert so I can’t tell what’s wrong… Any help is appreciated.

    Using the_secondary_content(); in my code…

    Also, I noticed that upon upgrading to WP 3.0, full html editor button went away from secondary html editor window. It came back after I activated TinyMCE Advanced plugin. FYI.

    Thanks for the excellent plugin.

  106. [...] we need to install the Secondary HTML Content plug-in by C.Murray. This allows us to add up to four additional editable content blocks to each page. On it’s [...]

  107. Bill Dennen says:

    Jake,

    We’ve run into a problem where line breaks get messed up in the secondary html box when editing the page. Specifically, if you use the “HTML” editor on the main (default WP) content block, the line breaks disappear in the secondary HTML content box.

    To reproduce:

    - edit a page that has content in the Secondary HTML Content box.
    - switch to the “HTML” editor in the main WP content box.
    - go to edit the same page again (either reload, or find the page and edit it again)
    –> Secondary HTML Content has lost its paragraphs. All text is in one single paragraph.

    I just tested this on WP3, with twentyten theme.

    Also, is there some trick to making the HTML button appear in the toolbar for the Secondary HTML Content boxes?

  108. Jake Goldman says:

    Paul – that’s been in the plugin for a while!

  109. Jake Goldman says:

    Indeed, the media buttons seem to have broken with 3.0. Hoping to implement a fix very soon.

  110. Mas says:

    Hi Jake,

    After fooling around a little more, I found a solution which was this code:

    http://codex.wordpress.org/Template_Tags/get_posts#Reset_after_Postlists_with_offset

    Not quite sure why this one works and not the other, but it does, so it’s all good now.

    thanks

  111. Jake Goldman says:

    Glad you figured it out. To elaborate, when you perform a new
    post query (without assigning it to a new variable), WordPress will – from that point forward – see the current post in *that* query’s loop as the “current” content. This plugin uses the ID of the current post to find its secondary content. If you perform additional post queries in your template (without assigning a new query variable), you should always “reset” after that loop is done.

  112. Jake Goldman says:

    Bill (and others) – we’re investigating the media buttons and WordPress 3.0.

    Including the raw HTML editor was a mistake on my part to begin with. WordPress’ editor strips out a lot of tags, and handles double line breaks as paragraphing when outputting the content. This may be why they removed the button altogether. I’m investigating adding an pseudo-HTML editor like we have in the “main” content block.

  113. Dorothea Schäfer says:

    Great Plugin!

    I have got a Wordpress-Template wirth 3 content blocks. The content ist split on multible pages. But the additionals content blocks by the plugin do not page. Although I added to each content block, they show identical content on all pages of the multipages page

    Is there a workaround?

    — Thank you very much! —

  114. ubwhipd says:

    Hi Jake,

    When do you think a custom-post type version will be released? Is there a way I can alter the code myself to make it appear in a custom post type called ‘portfolio’ ?

  115. Jake Goldman says:

    Dorothea – I’ll investigate paging in the next update.

  116. Jake Goldman says:

    My initial goals for version 3.0 were probably a bit too lofty and taking too much time. I’m probably going to scale back a bit so I can get an update for custom post types out the door very soon.

  117. Paul says:

    Anybody care to give me the lowdown on including secondary content on the assigned blog page? I’ve been having to hardcode that stuff – not ideal. Anyone?

  118. jon says:

    I can’t figure out how to hardcode it on the assigned blogpage! I’m throwing in a the_secondary_content(1,37); and it’s working on everything but the home page (posts page) and the archive page. I even copied and pasted the page.php into index.php and still nothing.

  119. Steve says:

    Jake, I love what you’re doing with this plug-in, a feature that really should be included as an option for WP for sure!

    I too am looking for a custom post-type solution, and if it would help your service, I’m ready to make a good donation to help the cause! :)

    In the mean time, I might try to tinker with it and see what I can find!

    Cheers!

    S

  120. Jake Goldman says:

    Hmm the plugin doesn’t display on non-singular pages, but if a post ID is explicitly passed via the function it should show anyways. My head was too focused on the widget implementation. Will fix in the next update.

  121. jack says:

    Great plugin. I’m testing it right now to see how I can use it on my blog.

    A few things I bumped into.

    1. The fontcolor in the secondary html field in the post section is white (on white). Perhaps this has something to do with me using Ubuntu Linux. Perhaps you can explicitely make the color of the input black?

    2. The secondary html output shows nicely on single pages, but what I would really like to see is that is also shows up in the loop (monthly, index, etc.). Otherwise people that visit my site should always click on each single item to view all of its contents, instead of seeing it on the homepage.

    3. I never use the edit buttons (tinymce) in WP, but the standard quicktags.js which I adjusted to my needs with a few extra buttons. Could this be made into an option in the future? Edit buttons/Quicktag buttons.

    Thanks for this beautifull plugin. And I agree, it should be part of the WP core!

  122. jack says:

    My previous reply vanished… Don’t know why.

    Anyway, I tried to get the secondary content to show up always, including on the homepage, archivepages etc.

    I used the_secondary_content(1,4430); or the_secondary_content(1,the_ID()); but when I do this in both cases only the ID of the post is echoed and not the content: 4430??? The content is only showed when I do the_secondary_content(); and on single pages or post.

  123. jack says:

    Just wanted to say I added this plugin as an idea for a future feature in de WP core on the WordPress site, but people disagree. Needless to say I disagree about their disagreeing :) . I even made a small visual representation of why I think the functionality of this plugin is so important for a true cms like program, which WP is or will be. The visual even has a small button ‘add extra content block’ :)

    http://www.spoenk.nl/public/extra-content.png

  124. Jake Goldman says:

    Jack – I appreciate the sentiment, but I actually agree that it shouldn’t be part of core. 90% of users are content with a single content area – the content for their page or post – with maybe some flexibility around which widgets appear on each page.

    That said, I certainly think with some new fit and finish my plug-in could certainly be a canonical – or core – plug-in for the 10%ish who need multiple content blocks.

  125. Jake Goldman says:

    Jack – I’m not sure about #1, there’s a fix for #2 in the next update, and #3 is on the long term road map (trickier than you think for a small update).

    As to your functions, not sure why the first one isn’t working, but “the_ID()” does not return the ID – it echoes it.

  126. jack says:

    Forget about the code I used, if the extra content also shows up on index pages like the homepage or archivepages, that’s perfect for me. And the html for the next content boxes I can create by using the quicktags in the first content window and copy that to the extra content box. So I’m looking forward to the next update :) .

  127. Tim says:

    The editor is missing alot of functionality that the regular edit has e.g. source code view and the full complement of toolbar buttons

  128. Jake Goldman says:

    @Tim – it shouldn’t be missing many buttons. It adds a new HTML source code view (that’s a bit flakey admittedly, but integrating the default WordPress editor is trickier than you’d expect in a second block), and I think it removes the “more” divider which would be meaningless in the context of secondary content. What else is missing?

  129. Paul says:

    I’m in need to use this functionality in one of my project, I was wondering if using this plugin would be a lock-in, say if one day this plugin discontinued for whatever reason , What would happen to the the content ?

    Will it display normally as if there is only one full content or the additional block(s) will be missing and leave only main block appear ?

  130. lydia says:

    what’s the current status of the HTML source code view? i just downloaded your plugin and it seems like a great bet for me — wordpress is sorely missing this basic feature of drupal — but now i am confused. from watching your tutorial video i see that i am supposed to have an HTML button that will provide a code view. no such luck, and no media buttons either. so, no way to insert an image or add tags for styling. can you advise?

  131. Jake Goldman says:

    Paul – the content is stored in post meta (custom fields). You don’t see it in the custom field editor because it’s prefixed with an underscore that hides it from there. Removing the plugin will not drop your content into the primary editor / content area, but it also won’t delete it. You can access it by using the get post meta functions.

  132. Jake Goldman says:

    Lydia – I’m not sure why you don’t see the HTML button. The media buttons need to be turned on using the checkbox on the settings page for the plugin.

  133. Wayne says:

    Unfortunately I do not see an HTML button either in WP 3.01. You really need that

  134. lydia says:

    yes, tried turning on the media buttons. i now see that it looks like checking the media-buttons box is having no effect. permissions problem somewhere?? doesn’t seem like it could be a conflict with another plugin since the only other active one is WPListCal, which i’ve installed since this problem cropped up. tried from another browser in case something is being blocked somewhere — same problem from both FF3.6 and safari 5.0.1. and you haven’t seen this one, huh? very sad, a fix for this would make my life so much easier. would it help for me to email you screenshots?

  135. I am experiencing the same problem in WP 3.0. I’m using the plug-in with a theme that I developed in WP 2.9.2 and now I’m trying it on a new site in WP 3.0 but the media buttons and the HTML button are missing. I haven’t changed anything from the last site, the only difference is WP 3.0.

    Jake, have you experienced any other reports of 3.0 weirdness? That’s the only thing that I can think of.

  136. Jake, I have an update. I noticed when adding a new page that the HTML button and the Media buttons are in fact appearing, but after I publish the page they disappear. Hope that bit of information helps.

  137. Paul says:

    Thank you very much for the clarification.
    I’m now feel more confident to use your plugin for my project.

    I will design my page to contain the main content in the first block
    and use the 2nd/ 3rd/ 4th /5th blocks for additional data.

    Worst case scenario, the main content is still there ( the_conent ) and
    the additional data is still retrievable ( get_post_meta ) no matter what happens.

    Great plugin, please keep it up.

  138. Bill says:

    Jake, I’m not sure if I was clear in my earlier comment. (https://cmurrayconsulting.com/software/wordpress-secondary-html-content/#comment-6406)

    It has nothing to do with the HTML button on the secondary html blocks.

    Basically, when you save the page with the HTML editor selected in the main content block (ie. the WP default content block), you lose line breaks in the secondary html block.

  139. Mas says:

    Hi Jake,

    I have a client who wants certain pages to be password protected, so I used the wordpress visibility settings to set it to password protected. But the secondary html content in the sidebar still show up even when the main content says “enter password.”

    Any idea how I can make it work? I am using php code in my theme template to display secondary html content.

    btw, I agree with other posters that in WP3, html button doesn’t show up in secondary html editor window. Install TinyMCE Advanced plugin and move the html button into the tool bar and that solves the problem…

  140. Bill Dennen says:

    Regarding the missing upload and HTML button in WP3, I have a fix that works for us.

    We usually use the secondary html content on pages only. So, we have this setting set to ZERO:

    Posts
    – Number of extra HTML blocks

    If I set this to something other than zero, the buttons show up again!

    Weird, yes. But, it works. :)

    Let me know if this works for you! Thanks.

  141. lydia says:

    : your suggestion works for me, too — thanks so much!

    : FYI, i’ve also been seeing a weird behavior where, if i try to insert an image in the main content block, secondaryHTML takes it into a secondary block instead. i can avert the misbehavior by using the Visual editor to insert the image into the main block, instead of using the HTML editor.