Drop this in a plugin & activate. I should note this doesn’t take into account things like child themes – it’s purely for toggling which theme renders based on SOME_FLAG
.
add_filter( 'stylesheet', 'switch_ma_theme' );
add_filter( 'template', 'switch_ma_theme' );
function switch_ma_theme()
{
// Return the theme directory name
return SOME_FLAG ? 'theme-1' : 'theme-2';
}
Related Posts:
- How to store widget fields data as an array?
- How To Add New Option Types To Option Tree?
- Modular theme settings
- How does WordPress decide what template to use as frontpage
- get_option function
- Get category slug and display it on a query_post
- Why might $input (Settings API) be coming through empty?
- Multiple Custom_Background, is it possible?
- Static Front Page problem
- two tinyMCE editors in the same page
- Prevent WordPress updates from overriding custom language translations?
- Cannot update WordPress General Settings Site Title and Tagline
- How to upload images using Settings API
- Theme settings keep getting reset/erased
- Where should I update_options in a theme?
- How can I display/hide certain content based on a Theme Option field?
- wp-config dynamic hostname in WP_HOME and WP_SITEURL
- How can I make my options in an array and store theme in WP options one DB row?
- How to Call pages from a Options Panel
- Efficiency of wp_options vs a new table
- Redirect to another page using contact form 7? [closed]
- How to set wp_options in functions.php for removeing the Default Front Page
- Override plugin option by with a custom theme
- not getting API setting saved confirmation message after update on option page
- Update Specific Key Value in Complex `wp_options` object
- How to remove permalinks links presents in each page of my site?
- Tabbed theme options query about add_settings_section callback function
- WP_SITEURL vs WP_HOME link output
- Unable to delete option
- Theme Option’s Save Button is not working
- How to add custom css file in theme?
- CSS not updating in browser when I change it
- Is wp_is_mobile() effective?
- Display Menu Name using wp_nav_menu
- What questions do you ask when asked to give an estimate on theme development?
- How to remove dashicons.min.css from frontend?
- What’s the difference between home.php and index.php?
- Get url of thumbnail from the media uploader
- How to use logout function on custom menu link?
- Hide certain pages / posts on wp-admin, show custom filter
- WordPress Customizer Typography: How to load just the unique Google Fonts?
- Can we add more than one control under a setting in WP theme customizer?
- Widgets panel not displaying in the Theme Customizer
- How to show next Post Thumbnail image in WordPress using current post id
- How to add a section to the menus configuration, offering hard coded items?
- Am I using get_posts wrong?
- Call to undefined function get_current_screen() on my localhost
- Cache Busting using htaccess Rewrite rule?
- How to add oEmbed support to my theme?
- WordPress Multisite: Have the same header and footer of main-blog on all sub-blogs
- Custom header images won’t appear when set to random
- Modify Javascript Configuration Options for Theme Customizer Colour Picker
- Difference between is_page and is_page_template
- How to Globally Use wp_localize_script() Ajax URL
- add filter not working when cancatenating variables
- How to Edit the style of header title of Twenty Eleven Theme?
- WordPress Theme Development: How to redirect templates the right way?
- How can I let templates choose which stylesheets are enqueued?
- WordPress with broken paging page 3
- Location of theme options page menu icon
- Is it possible to edit the styling of the admin panel from within a custom theme?
- Can’t login unless twentyfifteen theme is active
- the_excerpt(); tag not working
- How to implement a $_SESSION alternative in WordPress inside a theme without a plugin?
- Storing the contents from txt file into The_Contents”
- How to show custom meta_key in each li of menu
- Can I add multiple arrays within add_theme_support( ‘colors’ )?
- Customizer – loading settings/controls/sections/panels based on a id/page id
- Where to place template files?
- [&hellip appearing instead of […]
- Getting author URL outside the loop
- Replace single_template filter with what for default posts?
- How to See Everything in get_option()?
- Is there Photo Categories?
- How to include a mu-plugin as a theme dependency?
- Why still output /wp-content/themes/twentynineteen?
- How to use ajax in wordpress and sending the data without refreshing ?
- Adding an external link to product grid list pages for woocommerce
- add shortcode support in customizer
- How to make my themes compatible with different WordPress versions?
- add jquery file if a certain page is included
- Exclude subcategory from wp_query
- Archives and Categories in Custom Menu
- Custom search template is showing 404 when adding query string
- How do I restructure the comment HTML layout?
- How to render block editor in wp-admin custom pages programmatically
- Fetch data from database with dropdown selected option
- How do I keep my iframes responsive and scaled to fit their container?
- Let user publish posts on community page
- How to perform str_replace on the results of wp_list_pages
- Why do WordPress developers use so many opening and closing PHP tags when developing themes? [duplicate]
- How would I get this to work – send to post from thick box
- Show category and description
- How can I demonstrate themes well?
- How to update my own theme?
- trying to figure out how to use more that one image upload in the same section in theme customizer
- WordPress custom jquery not found
- How to using custom DB tables
- Replacing static code in a template file with a sidebar and widgets?
- WordPress search field won’t get wider