WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to format each post that the user uploads.

I need the paragraphs to be floated to the left in the first column, and the images to be in a floated left in the second column.

(I've tried posting an image, but I need at least 10 reputation)

I am new to Wordpress development, so I apologise if this is a silly question.

share|improve this question

There are multiple ways to that but what I like to do is to create shortcodes e.g [one_half] :

function one_half_sh( $atts, $content = null ) {
return '<div class="one-half">' . do_shortcode($content) . '</div>';
add_shortcode( 'one_half', 'one_half_sh' );

Then the CSS can look like this :

.one-half {
width: 48%;
margin: 0 4% 0 0;
float: left;

The second column would have the same markup but with 0 margin. This allows to set a very flexible layout you can customize on each post.

EDIT: for the second column just create another shortcode with exactly the same code but add a CSS class such as .second-col you will style in your stylesheet

share|improve this answer
Thanks. Where abouts would the function be placed— where within index.php? – tmyie Aug 8 '13 at 19:16
no within functions.php of the current theme – JMau Aug 8 '13 at 19:58

Your Answer


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.