Right now i'm while using following wordpress plugin- 'shortcoder' to let me push the whole frontpage of my wordpress site utilizing a single publish. Following may be the structure of my publish-

 [shortcode 1]
 [shortcode 2]
 [shortcode 3]
 [shortcode 4]
 [shortcode 5]
 [shortcode 6]

At this time they are all static that contains only html and javascript content. This publish gets shown on my index.php while using 'the_content()' template tag.

However I'll be tugging some dynamic content from the other posts instead of a few of these shortcodes whose logic is going to be hardcoded within the index.php file. For eg.-

 [shortcode 1] static
 [shortcode 2] static
 [shortcode 3] dynamic
 [shortcode 4] static
 [shortcode 5] dynamic
 [shortcode 6] static

Simply to be obvious all of the static sections can come with the shortcode however the dynamic sections is going to be hardcoded within the index.php file. However, due to the serial order this logic gets screwed up.

I wish to in some way separate this content coming through 'the_content()' in to the appropriate static sections.

Sorry for that lengthy publish however i hope someone can develop an answer.

You can make your own shortcode(s) to call the scripts you need to run.

For instance, inside your functions.php file you could include something similar to this:

function my_shortcode_callback($atts){

   $name = attr('name');

      case 'script_1':
         // run code for script_1, maybe through a custom function
      case 'script_2':
         // run code for script_2, maybe through another custom function


add_shortcode('my_shortcode', 'my_shortcode_callback');

Now, inside your publish editor, you could include your personal shortcode connected using the plugin's, for example:

 [shortcode 1] static
 [shortcode 2] static
 [my_shortcode name='script_1'] dynamic
 [shortcode 4] static
 [my_shortcode name='script_2'] dynamic
 [shortcode 6] static

So, essentially, you would be making use of your wordpress plugin for static code as well as your own shortcode for dynamic code =)

Hopefully helps or will get you within the right direction. Tell me!

This is the way I solved my problem using normal php explode-

When i first added the '~' separator for those my shortcodes like -


Then while using following code I separated the shortcodes-

    $content = ob_get_clean();
    $part = explode('~', $content);

Next all Used to do was echoed the needed variables in the right spots within the template-

<?php echo $part[0]; ?>,....