Support » Themes and Templates » Adding new classes and IDs to classic theme

  • I’m currently modifying the classic theme, I would build my own but time constraints have gotten the better of me.

    Anyway, at the moment the sidebar code is something like #menu, #menu ul, #menu ul ul, etc etc, as you know, the classic theme in its default state.

    However I want each individual widget to be in its own block. A single box with transparent space between itself and the next one. That would require a ul acting as a spacer.

    I examined sidebar.php and widgets.php and I must say, I’m stumped. I can’t seem to add or take away any ul or li tags to create the necessary spacer. Obviously I’m missing a fundamental mechanism that powers wordpress.

    So how is it done, how do I add extra classes and ID tags to wordpress, notably the sidebar?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Also I should add that this problem affects me when I want to modify individual header looks, for example “Recent posts”widget on the sidebar just uses the font-family styling from the corresponding ul tag. I would like it to have an <h3> tag instead, except I can’t for the life of me find where to change it.

    I have a feeling I’ll run into this when I go to build my own theme so if I can find out how everything works now it will be a huge help for my existing site and sites to come in the future 🙂

    IMHO: For beginners at themes; it makes a lot of sense to scrap the widgets and do your own thing. God knows the default markup sucks enough anyway but it gives you much more control / flexibility.

    The problem is I use WPG2 and E-Commerce so I’m not sure if I can scrap the widgets?

    The default WP behaviour is that if a single widget is placed in a sidebar all the pre coded sidebar material will disappear. The choice therefore appears to be all or nothing. This is not the case. If you place your hand coded sidebar elements before the if conditional in sidebar.php they will remain there regardless. Thus you can hand code your sidebar in the way you want and you could still use widget functionality for your plugins. Alternatively a lot of people do not realise that the default widget markup can be adjusted by using function.php in the theme. Codex has all the info. But what you want is very doable.

    Ooh, thank you very much! I was getting quite frustrated being restricted, I’ll give what you said a go 🙂

    I second the “DIY” sidebar method, including your own code above/below the widget conditional in the template. Basically, if you’re building a unique theme to use only for yourself, then it’s the easiest way.

    Total widgetization is only important for those who release themes for general use, with no control over the end user’s plugins.

    And if we could have a nice link to your blog we can help you with any borkage. But just rereading the q adding a margin-top to #menu ul li
    would create a space I would think.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Adding new classes and IDs to classic theme’ is closed to new replies.