WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 working on a theme for a framework, and using shortcode to divide the layout, I've found the following problem:

Into a content, I can divide the container into 12 different parts, it also applies for content inside the content (and this is when problem comes), meaning, for sample, if I decide to set 8 and 4 columns, and then the 8 columns I want to divide it into 2 parts, I would need a structure like this:

  [8 columns]
      [content]   <-- PROBLEM IS HERE
          [6 columns]
             half of eight part 1.
          [/6 columns]
          [6 columns]
             half of eight part 2.
          [/6 columns]
  [/8 columns]

  [4 columns]
     some content here
  [/4 columns]

When I try to executed this logic, the second content is not being taken, and is displayed as text.. so... I thought the shortcode into a shortcode logic would work, however... it doesn't work if the SC is the same, in short works this (my code) is not working for me.

 function content_sc($atts, $content = null){
   return '<div class="content">'.do_shortcode($content).'</div>';
 add_shortcode('content', 'content_sc'); 

Any guessing???

Thanks in advanced!!!

share|improve this question
up vote 1 down vote accepted

Referring to the codex article on shortcodes, you cannot use a shortcode within itself...which is to say that the following is invalid:


you should probably make an inner-content shortcode or something.

share|improve this answer
This is what happens if you try to parse non-regular structures with regular expressions. -.- – Raphael Feb 19 '12 at 11:33

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.