• Hi,
    I’m using Alex King’s excellent Style Switcher but would like to change the way it displays the options. Instead of creating a vertical list like this:
    red
    blue
    green
    purple

    I would like to produce a horizontal list seperated by commas. Like this:
    red, blue, green, purple
    I know almost nothing about php but guess that the code I need to modify is this part:
    if ($in_list == 1) {
    $ss = '<li id="style">Style:'.$ss.'
    ';
    }
    echo $ss;

    Can anybody help? Have I misunderstood the problem, is my answer contained in the CSS?
    TIA
    Phillip

Viewing 13 replies - 1 through 13 (of 13 total)
  • Indeed the answer does ……
    Looking at your page, if the choices stay where they are, then although they could display inline they could wrap messily ?
    Do you plan on them remaining there, or are you wanting to move them ?
    I ask because the solution would / could be different …..

    Thread Starter planetphillip

    (@planetphillip)

    *bump*

    It is just a list, why don’t you set it to display:inline?

    Yup …
    Into CSS add:
    .style {
    display: inline;
    }
    In the index.php, you can do it by manually creating the styleswitcher setting:
    <li>Styles
    <ul>
    <li class="style"><a href="//www.bbc.co.uk/index.php?wpstyle=four"">Blue</a></li>
    <li class="style"><a href="//www.bbc.co.uk/index.php?wpstyle=four"">green</a></li>
    <li class="style"><a href="//www.bbc.co.uk/index.php?wpstyle=four"">yellow</a></li>
    <li class="style"><a href="//www.bbc.co.uk/index.php?wpstyle=four"">red</a></li>
    <li class="style"><a href="//www.bbc.co.uk/index.php?wpstyle=four"">orange</a></li>
    <li class="style"><a href="//www.bbc.co.uk/index.php?wpstyle=four"">purple</a></li>
    <li class="style"><a href="//www.bbc.co.uk/index.php?wpstyle=four"">white</a></li>
    </ul>
    </li>

    Thread Starter planetphillip

    (@planetphillip)

    Beel:
    Becuase I didn’t know it existed. ?? Thanks for the heads up.
    Podz:
    That works, thanks. I don’t want to seem ungrateful, but, it’s not exactly what I want. I have a few static pages, which means I will have to edit every page when I add or remove a new style/colour.
    I tried add this to my index.php page but it didn’t work. Is there an obvious reason why?
    <li class="style"><?php wp_style_switcher(); ?>

    Thank you both for your help so far.

    Hang on, I just woke up and need some coffee. I will edit this in a minute or two…

    Thread Starter planetphillip

    (@planetphillip)

    YOU ARE THE MAN!
    Your code works almost perfectly in Mozilla but ignores the commas in IE6. Neither Mozilla or IE6 adds the period at the end but that doesn’t matter at all.
    At the risk of upsetting you, now I see both, I think the comma-less one looks better.
    Thanks for your help.

    I never liked those psuedo-elements anyway, too browser specific, etc. I just wanted to see if it could be done in non-IE browsers. That last comma would have been a killer for me and I saw there was no way to prevent it without having to do considerable hacking in styleswitcher (too much work to remove a simple comma!).

    I tried adding the

    .style {
    display: inline;
    }

    to my style.css and it did nothing. Any idea how I might have messed up?

    aliasjanedoe – a link to your site would help us ??

    https://www.different-dimension.com/AliasJaneDoe/wordpress

    I don’t have the display: inline thing in any of my css anymore in case it was doing something strange in another browser, though. But I want to be able to change how the styles list appears in just certain layouts (for now, the River Tam one), not all of them. Like I know you can do them as a drop-down box by editing index.php, but that would change it everywhere.

    I’m not sure you can do this in the version of WP that you have.
    In 1.2.1, the style switcher literally just changes the style, not any core files nor does it select any core files dependent on the syle being used.
    So you can have a vertical list, or a horizontal list.

    If you were to upgrade to 1.5.1.3, then the level of control offered there could give you the look you want. But….. there are many styles that existed for 1.2.x that do not exist in 1.5.x That said, there are many many more Themes and they really do offer greater flexibility.
    https://themes.wordpress.net/theme-viewer.php

    If you’ve any questions.. fire away.

    I’m not looking to upgrade. Something *always* goes wrong when I attempt upgrades of things. But thanks anyway. And if anybody figures it out for 1.2, let me know.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘modifying Style-Switcher’ is closed to new replies.