Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS WordPress Sidebar Classes

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32890
    tannercampbell
    Participant

    Okay … this is a big undertaking for me, I’ve never done a site of this magnitude (where WordPress is concerned) so please excuse the stupidness of this question; if it is indeed stupd.

    I designed http://tannercampbell.com as a WordPress blog from scratch, and I think I did a fairly awesome job. However it’s obviously not a very advanced theme — it’s not widget aware and it’s not fancy … it just looks nice.

    I’m currently working on http://demo.godelray.com

    I do not know how to address the sidebar widgets to style them. I understand that there is some code that goes in the functions.php file that allows you to assign classes to widgets … I’ve found it in the Codex but I do not understand how to use it.

    I realize that I could install the widgets I want, then view source and write classes into the css for those specific instances of widgets … but that prevents the client from ever changing them if they want.

    What I want to do is class all the h1 tags as sidebar … same with h2, ul, li, so that I can speak directly to them from css file …. problem is I don’t know how to go about doing that.

    I’ve been up for days trying to get this thing as close to done by tomorrow as possible – everything I’ve done so far has been done in two days, so I’m really busting ass on this … I’ll be up for another 3 or so hours, really hoping someone sees this by then.

    Thanks,
    Tanner

    #75183
    Brightonmike
    Member

    Here is mine.

    PHP Functions.php

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'sidebar',
    'before_widget' => '
    ',
    'after_widget' => '
    ',
    'before_title' => '

    ',
    'after_title' => '

    ',
    ));

    CSS Theme Stylesheet

    .rightBox  {
    margin-bottom:17px;
    }

    .rightBox h2 {
    padding:10px 0;
    color:#f0f0f0;
    text-shadow:1px 1px #222;
    }

    .rightBox ul li{
    padding:6px 0;
    border-bottom:1px solid #444;
    }

    .rightBox ul {
    border-top:1px solid #777;
    }
    #75169
    TheDoc
    Member

    My example from my functions.php file:

    // enables wigitized sidebars
    if (function_exists('register_sidebar')) {

    register_sidebar(array(
    'name' => 'Sidebar',
    'id' => 'sidebar',
    'description' => 'This is a widgetized area for the sidebar.',
    'before_widget' => '
    ',
    'after_widget' => '
    ',
    'before_title' => '

    ',
    'after_title' => '

    '
    ));

    register_sidebar(array(
    'name' => 'Footer',
    'id' => 'footer',
    'description' => 'This is a widgetized area for the footer.',
    'before_widget' => '
    ',
    'after_widget' => '
    ',
    'before_title' => '

    ',
    'after_title' => '

    '
    ));

    register_sidebar(array(
    'name' => 'Home Page',
    'id' => 'homepage',
    'description' => 'This is a widgetized area for the Home Page.',
    'before_widget' => '
    ',
    'after_widget' => '
    ',
    'before_title' => '

    ',
    'after_title' => '

    '
    ));

    }

    Then you can see what classes get spit out by the widget.

    #75139
    TheDoc
    Member
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.