WordPress.org

Ready to get started?Download WordPress

Forums

Responsive
[resolved] Request: please add widget area name to the class or id (7 posts)

  1. maxemil
    Member
    Posted 2 years ago #

    Could you please add the widgets position to the classes in the sidebar-x.php files..

    like this..

    <?php if (!dynamic_sidebar('home-widget-3')) : ?>
    <div class="widget-wrapper home-widget-3">

    or even

    <?php if (!dynamic_sidebar('home-widget-3')) : ?>
    <div class="widget-wrapper" id="home-widget-3">

    ect..

    It will make it easier to identify the areas for CSS styling (offer 1, offer 2, offer 3...)

    PS: that mean also to remove the class from the general widget area around home widgets..

    <div id="widgets" class="home-widgets">

    - maby this is a fix and not a request :)

    BTW: I registered to your forum, but I cannot post to it becourse I get
    http://punbb.informer.com/forums/topic/24582/pun-stop-bots-question/page/2/
    "Pun stop bots question" using both Chrome and Firefox

    Best Regards \ME

    http://wordpress.org/extend/themes/responsive/

  2. Emil Uzelac
    Theme Review Admin
    Posted 2 years ago #

    They're actually. Don't look what's in the sidebar, see the function.php instead and you will see:

    'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
    'after_widget' => '</div>'

    Thanks,
    Emil

  3. maxemil
    Member
    Posted 2 years ago #

    Hi,

    Not really...

    register_sidebar(array(
                'name' => __('Home Widget 1', 'responsive'),
                'description' => __('Area Six - sidebar-home.php', 'responsive'),
                'id' => 'home-widget-1',
                'before_title' => '<div id="widget-title-one" class="widget-title-home"><h3>',
                'after_title' => '</h3></div>',
                'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
                'after_widget' => '</div>'
            ));

    makes it show the widget type like:

    <div id="text-3" class="widget-wrapper widget_text"><widget content here></div>

    What I request is that the widget AREA that you specify is used as the id/class instead.

    like:
    'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s widget-home-1">'

    Becourse id="text-3" or class="widget_text" is not specifiv to the position/area on the website - but to the functionality of the chosen widget - I would have to make a css specification to all thinkable widgets, instead of on the area..

    We want the same thing, Im just doing it in another way.. :)

    BR\Emil

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    what stops you to change these:

    'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',

    to:

    'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s widget-home-1">',

    or however this needs to be done in a child theme.

  5. Emil Uzelac
    Theme Review Admin
    Posted 2 years ago #

    When you look at the source, this actually comes down to individual elements e.g.

    #text-1
    #text-2
    #text-3

    Also home widgets do have an extra class built in, it's called home-widgets

    It's similar but not exactly the same as yours :)

    Thanks,
    Emil
    P.S. @alchymyth thank you for being around, much appreciated :)

  6. maxemil
    Member
    Posted 2 years ago #

    @alchymyth nothing prevents me from using my own example.

    If anyone needs to do what I do:

    add_filter( 'dynamic_sidebar_params', 'add_my_widget_position_class');
    function add_my_widget_position_class($params)
    {
      $widget_class = $params[0]['id'].' '; // make sure you leave a space at the end
      $widget_class = 'class="'.$widget_class;
      $params[0]['before_widget'] = str_replace('class="',$widget_class,$params[0]['before_widget']);
     return $params;
    }

    BR\Emil

  7. Emil Uzelac
    Theme Review Admin
    Posted 2 years ago #

    Good stuff thanks!

    Emil

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags