Reputation: 59475
I admire this wordpress single (post, permalink) page, where the content is divided into two columns, the images are on the left and the text and comments are on the right. Does anyone know how I can replicate this within a wordpress theme? How would you make a post like this?
Upvotes: 0
Views: 1181
Reputation: 59475
add_shortcode('divider', 'shortcode_divider');
function shortcode_divider(){
return '</div><div class="column">';
}
All you need to do now is add [divider]
within the post;
Upvotes: 1
Reputation: 5846
if you can edit your theme, add a magic word that you put between the columns, for example "#NEW_COLUMN#" and before you print the post in the template file, split the columns whit
$columns = explode("#NEW_COLUMN#", $content);
if(count($columns) == 1)
{
/* print a single column page */
echo $content;
}
else if(count($columns) == 2)
{
/* print a two column page */
echo "<div class='left_column'>";
echo $columns[0];
echo "</div>";
echo "<div class='right_column'>";
echo $columns[1];
echo "</div>";
}
else
{
/* ops we can't handle this many columns */
echo $content;
}
add then you need some css to make the columns end up beside each other
Upvotes: 1