• Hi all

    I have been playing with wordpress and some themes all evening.
    I started to notice that some widgets (categories for eg) lost their css settings if you moved them around (say from sidebar 1 to sidebar 2) or if you added widgets to a sidebar instead of letting the default widget setup load. I delved into this, and think I have discovered the problem.

    If you use the widget in the default manner (don’t add anything to sidebar 1) and let l_sidebar.php do it by default, then the code in l_sidebar.php
    code<?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar(‘Sidebar 1’) ) : else : ?>
    <li id=”categories-1″>
    <h2>Categories</h2>
    . . . . . code
    returns the correct div id of “categories-1”. That’s fine, thats whats coded in style.css under the Widgets section, so the categories widget will get its correct settings and look great when you load the page in a browser.

    BUT !

    Lets say, I want to rearrange the widgets on the left sidebar (l_sidebar) or even place the categories widget on the right sidebar. the sidebar.php code now uses the dynamic logic from
    [code]
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar 1') ) : else : ?>
    [/code]
    functions.php is used to in conjunction with sprintf derivatives to return a dynamic div id for the categories widget something like

    [code]
    <!-- begin l_sidebar -->
    <div id="l_sidebar">
    <ul id="l_sidebarwidgeted">
    <li id="categories-167555471"
    [/code]

    So, because the div id is now “categories-167555471”, the css is not applied.

    Is there anyway to deal with this? Surely I should be able to put widgets wherever I like and have them pick up their css ?????

    Can anyone help, I have been wotking on this now for ages and no matter what I try, I hit a brick wall. I’d be fascinated to see the solution.

    Best to all

The topic ‘moving widgets around and keeping css styles’ is closed to new replies.