Use this code to echo your div’s ID
<?php $sidebar_layout = get_post_meta($post->ID, 'sidebar-layout', $single = true); ?>
<div id="<?php echo $sidebar_layout ?>">
<div class="content">
...
</div>
<div class="sidebar">
...
</div>
</div>
If you want to apply styles according to the selection the user has made then change your style sheet as follows:
#left .content{ ... }
#left .sidebar{ ... }
#right .content{ ... }
#right .sidebar{ ... }
#none .content{ ... }
#none .sidebar{ ... }
I hope this helps.
Related Posts:
- do_shortcode() doesn’t do shortcodes ;)
- HowTo: Add Class to Sidebar Widget List-Items
- Allow Shortcode in Theme Customizer
- How to wrap the widget content with a div or get the widget title outside?
- Can I create customizer setting that can handle plugin shortcode?
- enqueue script for specific shortcode
- Why does my short code get executed before other content?
- Run shortcode before filters
- Add class to before_widget for all widgets with a dropdown and a counter
- How to get the name and description of a sidebar in theme?
- Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying
- How the WordPress sidebar works
- Can not Remove Archives and Meta from Sidebar
- How to allow admins to create a sidebar from the admin
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- What is wrong with this code I have to make a blockquote shortcode
- Best practices: Custom theme sidebar menu – hardcode or widget?
- how can I remove the sidebar from my wp homepage [closed]
- Toggle Sidebar Display
- searchform.php override not working
- Custom shortcodes not working using __s theme
- Place the page title into the short code
- How to provide support for [gallery] shortcode?
- Responsive embed for the video shortcode
- How to display all subpages and short by year
- Displaying details of a post in a sidebar
- “Theme without sidebar.php is deprecated”
- Load sidebar template just once to prevent multiple animations
- do_shortcode() in twentyeleven theme
- How to Manually Code Shortcode?
- How is the `get_sidebar` function meant to be used to call a 2nd sidebar?
- Should I create multiple sidebars, or use or one dynamic sidebar with logic to determine it’s abilities?
- How can I hard code my sidebar?
- Extract all shortcode data from post into loop variables?
- Shortcode IF statment help
- Should is_active_sidebar() always be used around dynamic_sidebar()?
- Extending custom shortcode to also be called directly from theme PHP pages
- Shortcode call not working in WP Template
- Shortcodes do not work in own template
- Load different single.php templates according to post layout selection
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- How to add sidebar to Isola theme? [closed]
- Pagination fuction in shortcode always displays on top
- Allow different tags in widget titles
- Change the sidebar from left to right twentyfourteen theme
- Changing sidebar.php and footer.php depending on URL
- How to use shortcode inside of shortcode in theme
- Recommended sidebar / content widths
- WordPress Shortcodes – Optional Styles
- How to setup sidebar modules to use jQuery Accordian
- wordpress script_loader_tag in function.php
- Sidebar not displaying (theme development)
- Theme does not allow shortcodes
- wordpress custom category post shortcode
- Cold Fusion to WordPress
- Avoiding do_shortcode() loops
- how to edit woocommerce checkout page
- Display problems in admin dashboard when creating a new theme from scratch
- Undefined index: custom_sidebars
- Best strategy for providing theme options using customizer
- TinyMCE strips content while pasting. Possibly a bug
- Creating a Playlist of Widgets
- How to display only some widgets of a sidebar?
- How to Remove Sidebar when get_sidebar() is not get called in page?
- WordPress two sidebar layout or theme
- Passing a location-dependent array via wp_localize_script within a shortcode
- Problem using $var for shortcode attr value
- Conditional tags issue for multiple is_page() conditions in sidebar.php
- Multiple Content Shortcodes
- Onepage with shortcodes
- Incorrect sidebar showing on WooCommerce Store page [closed]
- Replacing static code in a template file with a sidebar and widgets?
- why my WordPress theme doesn’t support shortcode? [closed]
- how can i modify the default wordpress sidebar
- Menu items description? Custom Walker for wp_nav_menu()
- Where to put my code: plugin or functions.php?
- How to define and link full path to css located at a random folder on header.php
- Sizing screenshot.png without losing aspect ratio
- Software for WordPress Theme and Plugin Development? [closed]
- When to use is_home() vs is_front_page()?
- What is the preferred way to add custom javascript files to the site?
- Get the blog page URL set in Options
- How to create .pot files with POedit?
- How do I get the theme URL in PHP?
- Why when I submit a form in wordpress it loads a 404 page though URL is correct
- What is the constant WP_USE_THEMES for?
- Worthwhile to restrict direct access of theme files?
- How Do I Protect My Premium WordPress App Theme from Copying?
- How to detect mobile devices and present them a specific theme?
- Using wp_add_inline_style without a stylesheet
- How to add posts to custom menus?
- WordPress Theme Preview Image
- How To extend WP_Customize_Control
- What is the difference between front-page.php and home.php? [duplicate]
- How can I get page slug
- Does the functions.php file ever get called during an AJAX call? Debug AJAX
- When to use _e and __ for the translation?
- What is a Theme textdomain?
- How to show a custom meta box on the “Quick Edit” screen?
- How to add CSS class to custom logo?