Support » Plugin: Theme Switcha » Links to theme redirects to homepage.

  • Resolved lemurianphoenix

    (@lemurianphoenix)


    Hello, I hope you can help with this. I wanted to use this plugin with the option to link to specific themes, and I embedded links to two different themes in my navigation menu. It works perfectly for switching the themes, but the problem is that it always redirects to the home page when switching the theme. I’m guessing this happens because I’m using a specific link. Is there any way to do this with the link option where switching the theme will keep it on the current page?

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

    (@specialk)

    Hi @lemurianphoenix, glad to help. I’m not sure which method/link-format you are using for the switch-theme links, but the shortcodes provided with the plugin are designed to keep the user on the current post/page. For example, if you add the following shortcode to any post or page:

    [theme_switcha_list display="list"]

    When a user clicks one of the displayed theme links, the switched theme will be enabled and the user will be kept on the same post/page.

    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    No, I wasn’t using that short code. That doesn’t display things how I’d like. I’m getting the links to change to specific themes from the settings page and then I’ve put those links into my navigation menu (where I have icons to display light and dark mode instead of text).

    Plugin Author Jeff Starr

    (@specialk)

    Yeah then I’m not sure, you’re sort of going beyond what the plugin provides functionality-wise. I know the shortcodes are tested and work to keep the user on the same post/page. But beyond that, any custom code/techniques I’m not sure.

    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    I didn’t realize I was going beyond the bounds of what the plugin was supposed to do. There were links provided on the settings page and the instructions seemed to indicate these links could be used to let users switch their themes. It was easy to set up and works fine other than the fact that redirects to the home page.

    I tried playing with the shortcodes provided and they really didn’t work well or look good on my webpage. The dropdown menu worked fine, but it wasn’t vertically centered properly in my navigation menu. I’m not sure how to fix that.

    Also when attempting to use the list shortcode it just displays the css code on my navigation menu.

    Either way, I don’t think either of those options was the look I was really going for appearance wise. What I really wanted was a toggle switch (or buttons) to switch between two themes. I couldn’t find a plugin that did this properly, so I figured I could just settle for regular links with symbols showing. I might possibly use the drop down menu though if there’s a way to fix the vertical alignment.

    Thanks in advance for any information.

    Plugin Author Jeff Starr

    (@specialk)

    I may be able to help with some CSS to align the menu, but it really depends on the specific context as to which rules might be useful. If you want to share a link to your project, I would be glad to take a look. Or if you would prefer not to share the URL publicly, you can always reach me via the contact form at Perishable Press.

    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    Here is the website I’m working on. Only the first two themes in the list are relevant. I haven’t yet had the chance to filter out the rest. In my case it would probably be easier to have a code that makes all themes private except the ones I want. https://ascensionvibrations.com/ You’ll be able to see that the drop down menu is placed higher than everything else in the navigation menu.

    Plugin Author Jeff Starr

    (@specialk)

    Here is one way to adjust the position so that it’s more aligned with the other menu items:

    <style>select.theme-switcha-dropdown { margin: 15px 10px 0 0; }</style>

    You can either add that code as-is to any post or page, or to apply sitewide, add to your theme’s stylesheet. If you add to your stylesheet, remove the surrounding <style> tags. (There are other ways to add custom CSS as well, just FYI.)

    • This reply was modified 1 year, 4 months ago by Jeff Starr. Reason: adds info
    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    Thanks, that worked pretty well, though I adjusted the top margin just a bit to 18px as it was still higher than I wanted.

    The only slight issue now is that if anyone actually clicks on “Choose a theme” then it takes them to a Not Found, Error 404 page.

    Plugin Author Jeff Starr

    (@specialk)

    That actually is a bug. I just confirmed on default WP so will add to the list and get it fixed up for the next plugin update. In the meantime, as a workaround you can leave the “Choose a theme” text blank/empty; if the user clicks the empty line it will just reload the current page (instead of going to 404).

    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    That works! Thanks for all the help!

    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    One other question, how do I get this shortcode to be centered in other parts of the site. <div style="text-align: center;">[theme_switcha_select text=""]</div> doesn’t work and it’s still left aligned.

    Plugin Author Jeff Starr

    (@specialk)

    If you can let me know a URL and location on the page, I will be glad to take a look and help you with a basic CSS technique that may help.

    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    Unfortunately there’s no url yet. I was in the process of trying to create a page when I ran into roadblocks trying to place the shortcode, so the page isn’t published yet.

    All I can really tell you at this point is that the page will have a very simplistic layout since what I’m trying to do is create a Linktree type of page without being reliant on a third party site. So it would basically just be in a div in the main body of the page, either at the top (with some minimal padding) or between the page title and the list of links. I won’t be able to decide exactly where I want it without being able to see it properly in the page editor. I just know that I want it centered on the page regardless of screen size/device.

    Plugin Author Jeff Starr

    (@specialk)

    It can be a bit dicey trying to write CSS when you can’t look at the HTML/context it represents. That said, you can try something like this:

    <div class="theme-switcha-custom">[theme_switcha_select]</div>

    And then for the styles, like this:

    .theme-switcha-custom { text-align: center; }
    select.theme-switcha-dropdown { display: inline-block; }

    Again, that’s just a stab in the dark, your mileage may vary.

    Thread Starter lemurianphoenix

    (@lemurianphoenix)

    Sorry it took awhile to get back to you on this. Been sick with the flu all week and only just tested this now. So far it appears to work fine in the different positions on the page I’ve tried and stays centered as I resize the window.

    Thanks again so much for all the help.

    One additional thing. Have you ever heard of themes that you’d previously hidden from the plugin suddenly showing up again? I’m almost positive that I marked off all of the themes I didn’t want showing up in their css files, but when I was editing the page just now, I saw two of them had reappeared and the line in the css header was no longer there. I’m really not sure what happened there, and I may need to wait and see if it happens again to be sure that I didn’t overlook those two themes originally, but I figured it couldn’t hurt to ask.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Links to theme redirects to homepage.’ is closed to new replies.