Is it possible to split the_content()
into three equal size columns?
I have tried to achive that by getting this code which I found here
<?php
$content = get_the_content();
$strings = wordwrap($content, (word_count())/3, "<br />"); //Put a {BREAK} every 500 characters
$chunks = explode("<br />", $strings); //Put each segment separated by {BREAK} into an array field
//Printing each chunk in a div
foreach($chunks as $chunk_content) {
echo "<div class='col-md-4'>";
echo $chunk_content;
echo "</div>";
}
?>
and this is the code in my function.php
function word_count() {
$content = get_post_field( 'post_content', $post->ID );
$word_count = str_word_count( strip_tags( $content ) );
return $word_count;
}
This creates pieces but there is more than three and therefor the text is still readable horizontally across the columns...... I don't now why it shouldn't work?? Hope someone could take a look!