two columns content layout
-
Hello,
I’ve been searching for a method to split the post’s content automatically, in order to control by html the page layout, in two columns side by side i.e.
I’ve found a very useful thread, and, using the first formula there provided, I’ve realized the last post’s word disappears, don’t know why.
Here I’m going to reproduce the code we can find in the topic. I quote:
“Add the following just after the start of The Loop in your Page template:
<?php $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]); ?>
“Can anybody confirm the code works well ?
For me, as said, the last word just get lost.
Also, I’ve had some problems with a post containing some hyperlinks, and which seemed to break the entire layout (once more, no idea).If someone try it out, thanks for reporting any result.
- The topic ‘two columns content layout’ is closed to new replies.