Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Mattaton

    (@mattaton)

    I added a bit of jquery to get this done. Instead of submitting a form supplied by the plugin, I used this:

    $(".themes li").click(function (event) {
            var styleID = $(this).attr("data-switch");
    
            event.preventDefault();
    
            $.ajax({
                type: 'POST',
                url: window.location,
                data: {
                    user_stylesheet_switcher_choice: styleID
                },
                complete: function () {
                    window.location.reload(true);
                }
            });
    
            return false;
    
        });

    Then I just used the session variable set up by the plugin to highlight the currently selected theme in my UI.

    Works so far in my testing! ??

    Plugin Author vgstef

    (@vgstef)

    Nice. Do you have a website I could look at to see how your ui looks like?

    Thread Starter Mattaton

    (@mattaton)

    The site isn’t live yet. Still working on it. I’ll try to remember to circle back around here to post a link once it’s done.

    The above code works great for just loading the proper css file on the fly.
    One thing I do have to get hooked up at some point is assigning the theme choice as a user variable so that the selected theme will follow the user. But, that’s a little ways off as we’ll be using a forum user database instead of the default WP user table. So, what I need to hook into isn’t even there yet.

    Slowly, but surely! ??

    Plugin Author vgstef

    (@vgstef)

    Hi Mattaton,
    I just updated my plugin. I made many important changes, the main one is using javascript to update user CSS choice. So now, the page doesn’t use forms and doesn’t have to reload.
    I invite you to test the new version.

    Thread Starter Mattaton

    (@mattaton)

    Thanks! I will do that the first chance I get!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom UI’ is closed to new replies.