The way I do it is create multiple layout files, add the option to choose which one to use on the template options panel:
layout-left.php
layout-right.php
layout-both.php
Then on the index page you setup if layout X is chosen, load X layout. This is an example using the option tree plugin theme options:
<?php get_header(); ?>
<?php if( get_option_tree( 'mz_layout' ) == 'right') { ?>
<?php get_template_part( 'layout', 'right' ); ?>
<?php } else if( get_option_tree( 'mz_layout' ) == 'two') { ?>
<?php get_template_part( 'layout', 'two' ); ?>
<?php } else if( get_option_tree( 'mz_layout' ) == 'left') { ?>
<?php get_template_part( 'layout', 'left' ); }?>
<?php get_footer(); ?>
I’m sure there are other methods, but this should give you an idea.
Related Posts:
- The the_post_thumbnail without srcset?
- after_setup_theme always runs
- Using classes instead of global functions in functions.php
- WordPress API Menu/Submenu Order
- How to move page template files like page-{slug}.php to a sub-directory?
- Add custom classes to anchor in wp_nav_menu
- What WP folder can I use to write files to?
- Are the WordPress Core CSS styles really all nessesary?
- Why I can’t add a CSS style in this WordPress theme?
- Setting multiple default background images?
- How to make a theme with more than one CSS file?
- register_sidebar ignores ‘id’ and ‘class’
- Display a different theme for not logged-in users
- Best practice (forward compatibility) for theme options
- Add colors to existing color palette without replacing it
- Single Page WordPress Theme – Using page templates
- Select menu on browser resize
- Can I upload WordPress-react theme in Wp theme repository
- Returning Variables back into a template
- new theme permissions don’t allow me to edit
- Which theme foundry has clean coded themes, where code is poetry [closed]
- What page should I use for a contact form?
- Retrieve data using wpdb to use for customizer controls
- How can a Theme Contain no Header File or Footer File?
- Cannot get full thumbnail size using the_post_thumbnail
- Version control for both Vagrant config and themes being developed [closed]
- Is there a way to activate different theme for specified users? [closed]
- Some translations do not work in my template class
- WordPress not registering Theme Customization Section
- How to remove a file included in parent theme with locate_template() via child theme?
- qTranslate with my own theme and settings
- Stylesheet not linking
- How to control layout of posts on page?
- Override template file i subfolders
- Theme Development for WordPress Multisite Installation
- How to add infinite scroll?
- Include Parent functions.php in Child Theme functions.php
- create category on theme setup
- Change locale by detecting viewer’s browser language setting and let them choose prefered language after
- Why is it needed to enqueue parent stylesheet in child theme?
- WordPress Unite Theme: Footer isn’t sticking [closed]
- WordPress get_template_part() function not working
- Is accessing theme and using customizer GPL distribution?
- Where am I doing wrong in my theme menu?
- How can my theme allow users to take advantage of advanced html tags in posts
- How to enqueue javascript for WP Customize options sidebar?
- WordPress 500 Internal server error when activating custom theme [closed]
- How to Find the Page the Front Page is Using?
- correct tags for validating input types
- Renaming a theme so it aids SEO and the theme used is hidden
- How do I get the trackback count of a post in wordpress without writing an SQL query?
- WordPress 3.8 Backend Admin Color Scheme add more scheme how to do?
- Theme thumbnail in dashboard
- 3 Level Deep Navigation Menu Not Showing All Levels
- How to change the theme directory uri for localhost?
- How to Have a Pure HTML Sub Directory In WP Site
- Theming Using Bootstrap Glyphicons and WordPress Dashicons
- WordPress page/blog incorporated into static website
- Random white space before doctype
- How to add menù section to my WordPress template?
- What are the critical theme files when building a custom theme?
- Having issue with WordPress wp_enqueue_style
- Starting point for custom Themes [closed]
- Theme Development -> Specific Homepage
- Customizer: get_preview_url() inside customize_save_after hook
- New to WordPress – Read the Codex, Other Docs; Still Confused
- How add built-in textarea in theme development?
- Filter didn’t work on content class (hybrid_post_attributes)
- Post archives link yields a 404 Not Found
- How to change a local wordpress installation xml export file urls? and change them to what if you don’t have a live website?
- Trying to link to a php template file but its blank
- Let user to upload multiple time
- Theme author.php transfer
- Custom Enfold theme tab layout not compatible with WPML
- How to test another theme in a live WordPress website instead of live preview?
- WordPress uploads do not show up and I see the white screen of death in some cases
- register_theme_directory() sees custom themes directory, but blank frontend
- Can’t upload images on new theme
- Any way to permanently translate themes?
- Primary Menu Showing All Pages With No Sub-Nav
- Theme Development : License help
- Why the slideshow is not shown in my theme?
- Theme customizer live preview JS- Trying to bind to an html image url without luck
- Displaying Tags for the Page I’m On?
- How to make navigation a list without a plugin? [duplicate]
- Getting all months in one year WordPress Archive
- Purchased Theme to Custom Made Theme? [closed]
- How to make website with many template that active [closed]
- Image Size wrong during upload
- How to create full header but keep content narrow
- Correct way to make a custom block theme responsive
- How to show associated fields if checkbox is checked in customize widget screen using wp_customize?
- Dynamic nav menu with icons [closed]
- How do I send out an update for my custom wordpress theme?
- TItle In Latest Post is not using H1 Tag [closed]
- Is via.placeholder.com a good site to auto-generate placeholder images?
- Should we escape the values of constants?
- How to Add Dynamic Sliders to WordPress Customizer with JavaScript
- How to add multiple custom blocks in custom WordPress theme using create-block?
- Why is wp_nav_menu() not removing the container around the nav ?