• Resolved David A. Kennedy

    (@davidakennedy)


    Hi all,

    I’m looking at using the Theme Switcher plugin to give visitors the option of selecting a slimmed down (as far as styles go) theme for a site I’m working on.

    Problem is: My theme is a child theme of Twenty Eleven, so the plugin shows Twenty Eleven as an option… I only want to show my main child theme and the other child theme I would create (with the slimmed down styles). I assume the plugin does this because it’s pulling all available themes from the themes folder.

    Has anyone seen tutorials or options for making this happen? Limiting the selection of themes? I’ve looked here and there and haven’t found anything.

    Any help would be appreciated. Thanks!

    -DK

Viewing 2 replies - 1 through 2 (of 2 total)
  • You’re correct. The only “check” the plugin goes through is if the theme is published or not, so it will display a full list of available themes. A quick fix would be to simply add a condition that if the theme name is “Twenty Eleven”… skip it when building the list of available themes.

    This will not be a UI enhancement for the widget (if that’s what you’re using) and will need to be applied directly to the plugin. Also, this will not survive a plugin update. Considering it’s not been updated in almost two years (and no word of future development) you might not run into that problem. ??

    Anyway, open up the plugin source: /wp-content/plugins/theme-switcher/theme-switcher.php (version 1.0)

    Look for the following lines (should be line 177 & 178):

    // Skip unpublished themes.
    if (empty($theme_name) || isset($themes[$theme_name]['Status']) && $themes[$theme_name]['Status'] != 'publish')

    Replace those lines with the following code (with new condition):

    // Skip unpublished themes or Twenty Eleven
    if (empty($theme_name) || isset($themes[$theme_name]['Status']) && $themes[$theme_name]['Status'] != 'publish' || $theme_name == 'Twenty Eleven')

    This will hide the Twenty Eleven parent theme (or whatever theme name you place there) from the list on the front end.

    Let me know how that works out.

    Thread Starter David A. Kennedy

    (@davidakennedy)

    Chris,

    Huge thanks! This is working like a charm.

    I decided to just place the plugin code in my functions file, to prevent future update overrides. I’ll keep my eye on the plugin itself for updates…

    We’ll be using this to write a simplified stylesheet for a site that focuses on typography and contrast.

    Thanks again!
    Dave

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Use the Theme Switcher Plugin with Child Themes’ is closed to new replies.