Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

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

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

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
add comment

1 Answer

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:

[foo]
    [foo]
    [/foo]
[/foo]

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
add comment

Your Answer

 
discard

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.