Right now I am using the following plugin- ‘shortcoder’ to allow me to push the entire frontpage of my wordpress site using a single post.
Following is the structure of my post-
[shortcode 1]
[shortcode 2]
[shortcode 3]
[shortcode 4]
[shortcode 5]
[shortcode 6]
Right now these are all static containing only html and javascript content. This post is getting displayed on my index.php using the ‘the_content()’ template tag.
But now I will be pulling some dynamic content from my other posts in place of some of these shortcodes whose logic will be hardcoded in the index.php file. For eg.-
[shortcode 1] static
[shortcode 2] static
[shortcode 3] dynamic
[shortcode 4] static
[shortcode 5] dynamic
[shortcode 6] static
Just to be clear all the static sections will come through the shortcode but the dynamic sections will be hardcoded in the index.php file.
However, because of the serial order this logic is getting messed up.
I want to somehow split up the content coming through ‘the_content()’ into the appropriate static sections.
Sorry for the long post but I hope someone can come up with a solution.
This is how I solved my problem using normal php explode-
I first added the ‘~’ separator for all my shortcodes like –
Then using the following code I separated the shortcodes-
After that all I did was echoed the required variables at the right spots in the template-