Support » Themes and Templates » Question about using a 2 column content layout

  • Hi folks,

    I’m torn between using WordPress and for a site I’m working on.

    My question is: can WordPress be modified to allow easy editing of pages with 2 columns?

    CMS Made Simple has a ‘content block’ system which allows you to place 2 content areas onto each page… but I can’t think or find any way to do this with WordPress… and I don’t want to have to do something like insert the right column into the left column…

    Ideas much appreciated as ever



Viewing 8 replies - 1 through 8 (of 8 total)
  • If you don’t need weighting of columns, i.e. counting words and characters to fill both columns equally, it may be done.
    When you write a Page, you have the opportunity to choose which Page template you want for that Page.
    This also means that you can create a special two or three column page template for your needs.
    See: Page Templates. There is also a discussion of WordPress as a CMS.

    I think this should do nicely (not perfectly–wordwrap() as used below does not always split text evenly–but close). Add the following just after the start of The Loop in your Page template:

    $numchars = strlen($post->post_content);
    $content = wordwrap($post->post_content, $numchars/2, "{{break}}");
    $content = split("{{break}}", $content);

    Then (again in your template) within each column, you want to replace the_content() template tag with these:

    First column:
    <?php echo apply_filters('the_content', $content[0]); ?>

    Second column:
    <?php echo apply_filters('the_content', $content[1]); ?>

    Apologies, I should have said at the start that the 2 columns are seperate!

    No need to split the text automatically… there is a distinct left and right content block on these pages:

    ---------------- HEADER IMAGE ----------------
    -- Nav -- --- Left header -- --- Right header ---
    -- Nav -- --- Left block --- --- Right block ----
    -- Nav -- --- Left block --- --- Right block ----
    -- Nav -- --- Left block --- --- Right block ----
    ..........--- Left block --- --- Right block ----
    ..........--- Left block --- --- Right block ----
    ..........--- Left block ---
    ..........--- Left block ---

    Now, in the admin panel, you only ever have one text area for each page – that’s the part I couldn’t work out.

    Perhaps there is some kind of way to adapt the ‘more’ page splitter but using something like your suggested code, Kaf?

    Or perhaps a mod to the control panel that showed two text areas when editing these kind of pages?

    My main concern is that the solution must be simple and robust enough for a client to use! (Also there might need to be different header gifs at the top of either column, although clever use of sIFR might make this easier)

    Thanks again for your help.

    Might be the hard way, and would only work if you want the user to edit text, but you could always code divs in the sections of the template that were to be edited with an include to external .php files.
    Then via the admin panel, assuming you feel comfortable setting files within the theme with write permissions, the user edits the text.php files that are included within the templates.

    Yeah that could work – but they couldn’t use quicktags to insert links or anything that way – really need to allow editing using the normal methods if possible….

    Hmm sounds like a good idea for a new plugin to me!

    For something a little more programmatic, you can decide on a breakpoint tag to place in your content which define the two columns, say something like:


    (By using an HTML comment we avoid having it displayed if outputting the content “normally”.)

    Then nix my split code above and use this:

    $content = split("<!--nextcolumn-->", $post->post_content);

    From there, the two echo statements I have above work the same.

    Great, thank you!

    (I still think this could be a really nice plugin for CMS use – option to have distinct content blocks on pages and edit accordingly)

    Just tested this – working a treat!

    I will continue my quest to have multiple content blocks in the editor on another thread

    Thanks again Kaf.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Question about using a 2 column content layout’ is closed to new replies.