Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to place two columns side by side like a newspaper does and display one post's content within both.

multy column newspaper article

I've been trying to explode the content at my h4/90 words and echo the rest of the content along with its own markup but it won't display. At this point I'm questioning even my method. Any advice would be appreciated.

if (have_posts()) : while (have_posts()) : the_post(); 

$content = get_the_content();

add_filter('the_content', 'multi_content');
 function multi_content($content){
 $columns = explode('<h4>', $content);
 $i = 0;
 foreach ($columns as $column){
 $return .= "<div class=\"column\" id=\"content-$i\">" . "\n";
 if ($i > 1) $return .= "<h4>";
 $return .= $column;
 $return .= '</div>';
 $i++;
 }
 if(isset($columns[1]))
    echo $return;
 // $content = wpautop($return);
 // else
 // $content = wpautop($content);
 // return $content;
}
share|improve this question

1 Answer 1

Turns out there are specific CSS properties for columns:

Here's what worked for my case:

.featured {
       -moz-column-count: 3;
       -moz-column-width:245px;
       -moz-column-gap: 40px;
       -webkit-column-count: 3;
       -webkit-column-gap : 40px;
       -webkit-column-width:245px;
       -moz-column-rule-color:  #ccc;
       -moz-column-rule-style:  solid;
       -moz-column-rule-width:  1px;
       -webkit-column-rule-color:  #ccc;
       -webkit-column-rule-style: solid ;
       -webkit-column-rule-width:  1px;
}

And two refs for several other ways to go about it.

ADVANCED 2 column looping

SIX WAYS to use multiple columns

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.