WordPress.org

Ready to get started?Download WordPress

Forums

Style sidebar login (widget) (5 posts)

  1. URE
    Member
    Posted 3 years ago #

    Hi!

    Please help me!

    I'm using the sidebar widget in my page and I want to style it! When I look at the source code it shows that it uses the BlockContent-body class as the rest of the widgets (the default)!

    The question is - how do I style individual widgets if they use the default widget class (showen in source code)? How do I change the class fot the particular widget, so I could apply needed styles in the stylesheet?
    As I understand I have to make changes in the sidebar-login.php file, but the problem is that the php code is still a grey area for me! What should I look for?

    Thx alot!

  2. jepser
    Member
    Posted 3 years ago #

    Hi URE,
    try pasting this into your functions.php

    $p = array(
    		'before_widget'  =>   "\n\t\t\t" . '<div id="%1$s" class="widget %2$s">',
    		'after_widget'   =>   "\n\t\t\t</div>\n",
    		'before_title'   =>   "\n\t\t\t\t". '<h4 class="widgettitle">',
    		'after_title'    =>   "</h4>\n"
    	);
    
    // number of sidebars
    	register_sidebars( 2, $p );
  3. URE
    Member
    Posted 3 years ago #

    Tnx jepser for a quick responce! I'll try it when I'm back home!
    I have to put the class name where the "widgettittle" is?

  4. jepser
    Member
    Posted 3 years ago #

    now the id is generated in de div id, the widgettitle is just a generic class.

  5. jonnybeats
    Member
    Posted 3 years ago #

    This worked for me, many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags