The question is pretty simple, but it's complex in fact.
I have implemented custom sidebars for each post/page function in my blog.
It looks like:
<div id="<?php echo get_option('sidebar-layout');" ?>
<div id="content">
Some content
[myshortcode]
</div>
<div id="sidebar">
Sidebar
</div>
</div>
sidebar-layout option can have three values - left, right and none. And none is default. They are all set via metabox under post/page.
The biggest problem here is that when user chooses left - the first div gets "left" class and everything else is based on this ID, eg.
#left #content {
style;
}
And when he takes "right" then different style is applied:
#right #content {
another style;
}
So my "myshortcode" should basically change parents DIV id.
Any ideas how to achieve that? I believe my shortcode will be executed AFTER the div ID.
sidebar-layout
setting? The way you describe it, it looks like you use post metadata. Your code example usesget_option()
which reads site-wide options.