switch_theme() is the function you need but this…
why is someone changing the stylesheet and no longer changing the
theme?
… indicates a misunderstanding. You provide the $stylesheet as an argument but you are switching the theme as a whole not just the stylesheet. And, for reasons unknown, $stylesheet isn’t the stylesheet. It is:
$stylesheetis the name of your folder slug. It’s the same value that
you’d use for a child theme, something liketwentythirteen.
Related Posts:
- WP 3.4 – what action/hook is called when theme customisation is saved?
- Add a dropdown to theme customizer
- Is it good to rename theme folder downloaded from WordPress.org?
- Editing the custom background CSS
- What is the problem if I use CDN in my WordPress parent theme(built using bootstrap)?
- What, specifically, should be included in theme_name_setup()?
- How to get gallery images?
- Is it possible to use line break in theme description?
- Is the theme customizer slowing down my site?
- How can I get wp_head() as a string instead of echoing it?
- What does “Do not deregister the jquery script in the administration area” mean?
- What is the best book to learn how to make themes for wordpress?
- Grab the first paragraph of each post
- Symlink a directory to wp-content/themes
- How to check if post has any tag?
- What are WooCommerce starter themes? [closed]
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to disable the gradient and font size internal CSS added by WordPress when using theme.json
- Is there an error in get_the_tag_list()?
- Example of a theme organization without all the default wp files in root
- Which is the simplest theme for WordPress to use it as your base?
- “Cheatin’ uh?” error message on multple theme directories
- Adding WordPress colorpicker in widget settings
- Disable the Custom Internal CSS added by theme.json for Certain Pages
- Unwanted blank lines before tag
- A theme that follows all the best practices to learn from?
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- get_post() function returns post even if it is trashed
- How to highlight the current page in the nav menu?
- How do you protect a premium theme from being copied?
- “Display Site Title and Tagline” checkbox not working?
- Add social icons in a theme through custom admin menu
- file_get_contents Not allowed in Themes?
- Custom Nav Walker Displaying Values in Sub Menu
- How to configure wordpress to work with Vuejs with SSR and without hashbang
- How can one update a theme on a live site without interruption?
- Sub folder CSS that’s read by Admin panel
- How do I remove twentyten without ruining what I did?
- Custom theme not visible in Appearance
- Some doubts about how to show posts in a custom theme?
- Dequeue a style file which is making website load slow!
- Can’t delete theme
- How to add a second stylesheet to the editor
- Developing WordPress Theme using CSS framework like Bootstrap
- WP_Customize_Color_Control omitting # symbol
- Single Page theme [closed]
- Theme translation not applying
- How to add filter the post thumbnail before save in database?
- Can I have two different theme for two different language?
- Storefront child theme not applying parent theme [closed]
- WP_Comment_Query – Get comments and answers separately
- excerpt() shows different result between remote and localhost(development environment)
- Prefix best practice, should we use framework name or theme name?
- Theme Javascript.php Overwritten Nightly [closed]
- How to add Space between sidebar and footer widget in WordPress theme [closed]
- Theme Inspector “X-Ray”
- Acivate all themes multisite wide automatically
- Call to undefined function add_menu_page() on theme activation
- Is it acceptable for a WordPress theme to not accept widgets?
- Should all references to a text domain be to my current theme?
- Simple child theme modification but links are broken
- Making a WordPress theme based on twentyten
- theme style is applied on the dhasboard rather than the website
- Alignment Problem [closed]
- What $handle does WordPress use for a theme’s implicit style.css?
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- Create theme for mobile phones and tablets only?
- Never actually adding the action? Or do I have to call the action?
- How to hide custom sidebar on mobile
- Change Image Sizes for Mobile Theme
- Recommended sidebar / content widths
- Theme Checker Text Domain
- How to copy page/post from one theme to another?
- Not sure how to debug this npm install error. This is a wordpress theme that comes with a built-in gulp/webpack task automation [closed]
- Why front-page.php doesn’t show content of file instead shows loop
- How to make updatable custom WordPress theme?
- How can I not disable my theme when I want to upload a new version of it?
- Are paginated comments required for publishing Themes?
- How can I fix my theme header for my CSS stylesheet?
- Is hand coding required at all?
- Avoiding do_shortcode() loops
- Creating a Sub Category Template
- Correct was to customise theme using get_theme_mod in scripts
- Custom theme vs theme customization?
- how can I re-utilize and class on a child theme
- Modify comments_popup_link output
- How to figure out which wordpress theme a site was using?
- Can you create a custom page with content in the center already defined?
- Incorrect search results in search.php – issue triggered by using `define(‘BodyID’, ‘search’); the_post();` in search.php
- Flexslider not working for my custom theme WordPress
- “No Data Received” error in Chrome every time i try to update the theme functions file
- RSS feed url showing page not found. How to solve it?
- Redirect to custom login page
- How to close open divs in post loop
- Display Today’s date outside the loop?
- Confused on loading page content
- Turning WordPress Into full-featured website?
- Why am I getting posts back when I shouldnt
- How do I send out an update for my custom wordpress theme?
- How to add multiple custom blocks in custom WordPress theme using create-block?