On my wordpress installation, I created a new theme for a new page template I created. However, when I goto create new widgets, each widget automatically gets the class of “textwidget”. I have two different styles I have for widgets that require different styles, so I’m not too sure how to give each indivudal widget a different class or to label them differently?
Anyone know how to do this?
Here’s a page from my site with the 2 widgets: http://www.simonsayswebsites.com/how-we-get-you-more-customers/
You can see each one is within a widget that has the same class name.
This is what I added to my page functions.php to add the widget:
if ( function_exists('register_sidebar') ){
register_sidebar(array(
'name' => 'sidebarpage',
'before_widget' => '<div id="sidebarpage">',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
));
}
And here’s the snippet from the page template itself for it to display:
<?php /* Widgetized sidebar */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebarpage') ) : ?><?php endif; ?>
I could make it using different widgetized areas, but want to learn about having individual widget styles.
You are mistaking
nameandid.Also, in
before_widget, you shouldn’t declare a fixed ID, in your site both Widgets have the same ID and that’s… no good.If you follow the example in the Codex, your widget will receive an unique ID and a relevant class.
http://codex.wordpress.org/Function_Reference/register_sidebar
Default usage