• Resolved taylormairglow

    (@taylormairglow)


    Hello. This plugin works great to help our clients be able to switch their themes easily.

    At the moment, the active theme does not display first in the order of the themes that are available to switch between. Is there a way to display the themes in a custom order on the pages where the theme switcher is displayed? Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jeff Starr

    (@specialk)

    It’s not a built-in feature, but it is do-able just by writing your own HTML/list. Here is the format for a theme-switch link:

    https://example.com/?theme-switch=my-awesome-theme

    So you could add a link like this:

    <a href="https://example.com/?theme-switch=my-awesome-theme">Switch to My Awesome Theme</a>

    And to make it a list:

    <ul>
    <li><a href="https://example.com/?theme-switch=my-awesome-theme-1">Switch to My Awesome Theme 1</a></li>
    <li><a href="https://example.com/?theme-switch=my-awesome-theme-2">Switch to My Awesome Theme 2</a></li>
    <li><a href="https://example.com/?theme-switch=my-awesome-theme-3">Switch to My Awesome Theme 3</a></li>
    </ul>

    And then you can rearrange the list items into whatever order, etc.

    I hope this helps, let me know if I can provide any further infos.

    Thread Starter taylormairglow

    (@taylormairglow)

    Thank you very much for the response. This method does work to add links to change the individual themes.

    Additionally, the theme switcher list is on a custom admin page in the backend in a multisite network. Using the format below. it successfully changes the theme, but redirects to the main dashboard page instead of staying on the same custom page.

    https://example.com/subsite_url/dashboard/admin.php?page=page-appearance

    I attempted to add the theme switcher suffix after this URL to avoid the redirect, but the extra ? in the link makes the theme not switch correctly.

    https://example.com/subsite_url/dashboard/admin.php?page=page-appearance?theme-switch=my-awesome-theme-1

    Is there a way to make this link switch correctly while staying on this custom admin page? Or perhaps there is a way to add a redirect after the theme change to the custom admin page from the main dashboard page where the redirect currently lands?

    Plugin Author Jeff Starr

    (@specialk)

    Glad to help. Currently the plugin is not tested/supported on Multisite for network-wide activation (though it should work fine when activated on individual sites on the network). So what you are trying to do may or may not be possible.

    With that in mind, for the link you might try using proper URI syntax, where the query string is appended via question mark, and multiple parameters are separated by an ampersand. So applying that logic to the URL you mention looks like this:

    https://example.com/subsite_url/dashboard/admin.php?page=page-appearance&theme-switch=my-awesome-theme-1

    Thread Starter taylormairglow

    (@taylormairglow)

    That was it! Thanks so much.

    Thread Starter taylormairglow

    (@taylormairglow)

    Hi Jeff. After playing around with the plugin for a bit, I discovered that when the multisite user is logged in, the theme switcher only changes the theme in their backend dashboard. It doesn’t actually change the theme in the WordPress dashboard when logged as a super-admin and doesn’t display the updated theme on the front end in an incognito window.

    I know this isn’t necessarily what this plugin is for, but it’s the closest thing I’ve found to trying to move activating WP themes to a different location than themes.php.

    Do you know of a way to make the theme that’s switched to become active in the front-end itself instead of just a preview to see what their content will look like?

    Plugin Author Jeff Starr

    (@specialk)

    No I’m not sure. As mentioned Multisite is not something that is supported at this time. So your mileage may vary, some things may work, others may not, etc. By design the plugin switches theme on the site on which it is installed. So even in Multisite the plugin should work normally when installed/activated on a per individual site basis (i.e., not network-wide activation).

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Change Theme Display Order’ is closed to new replies.