• Hi,

    I’ve read a lot about this issue and tried many things but can’t get the result I want – to change the default twentyeleven theme.

    I’ve put this line in wp-config, with the theme folder I want:
    define(‘WP_DEFAULT_THEME’, ‘classic’);
    I get a blank page.

    Tried also to change the names of the themes in their stylesheets, their folder names. To change the default theme in default-constants.php. Nothing works.

    I am working with subdomains if that’s important to mention.
    I have a network of 50 sites and want to change all themes at once.

    Advice will be appreciated! ??
    Thanks…

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter tomystein

    (@tomystein)

    I thought maybe using a kind of this command:

    SELECT * FROM wp_options WHERE option_name = 'template' OR option_name = 'stylesheet' OR option_name = 'current_theme';

    But I don’t know how to select all wp_options (wp_2_options, etc…).

    Thanks.

    Thread Starter tomystein

    (@tomystein)

    Does anybody have any experince with this? Is it the proper place to ask or is there a multisite forum for questions like this?

    Yes, there is a multisite forum – it’s listed on this page:
    https://www.ads-software.com/support/

    I will move this thread there for you :).

    Thread Starter tomystein

    (@tomystein)

    Thanks a lot.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    For existing sites you have to edit them manually or via the DB.

    And you can’t select multiple tables on a search easily in SQL (for a variety of ‘don’t shoot yourself in the foot’ reasons). You’d have to script something via PHP or shell.

    Honestly, I’d do something like this:

    UPDATE wp_options SET template = 'current_theme', stylesheet = 'current_theme';
    UPDATE wp_2_options SET template = 'current_theme', stylesheet = 'current_theme';

    And make all fifty. Then paste it into phpMyAdmin and it’ll run ’em all.

    Read https://www.techonthenet.com/sql/update.php and practice on a safe local DB first! Also? BACKUP FIRST! ??

    Thread Starter tomystein

    (@tomystein)

    I think I will use Excel to create all the wp_options and then use the command you recommended, which I was thinking about as well ??

    Thanks.

    Thread Starter tomystein

    (@tomystein)

    Do I need to update current_theme as well?

    You mentioned template and stylesheet only.

    Thread Starter tomystein

    (@tomystein)

    When I try this,

    UPDATE wp_3_options SET template = 'templatedir';

    It gives me an error:
    #1054 – Unknown column ‘template’ in ‘field list’

    Thread Starter tomystein

    (@tomystein)

    this worked for me.

    UPDATE wp_options SET option_value='test' WHERE option_name='template' OR option_name='stylesheet';

    I’ll offer a couple snippets from my “mu-plugins”.

    First, as a temporary network-wide override of each site’s theme WITHOUT altering the site-by-site theme options.

    <?php
    add_filter( 'pre_option_' . 'template', 'override_template' );
    add_filter( 'pre_option_' . 'stylesheet', 'override_stylesheet' );
    
    function my_override_template() {
    	$foo = 'twentytwelve';
    	return $foo;
    }
    function my_override_stylesheet() {
    	$bar = 'twentytwelve';
    	return $bar;
    }
    ?>

    Second, to actually change each site’s theme options I’d hook the Update Network button with this snippet in “mu-plugins”:

    <?php
    function my_theme( $blog_id ) {
    update_blog_option( $blog_id, 'template', 'twentytwelve' );
    update_blog_option( $blog_id, 'stylesheet', 'twentytwelve' );
    }
    add_action( 'wpmu_upgrade_site', 'my_theme' );
    ?>
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Oh that is SLICK David! ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to change the default theme to existing sites on Multisite?’ is closed to new replies.