The MU forums have moved to WordPress.org

sidebar widget hack (12 posts)

  1. wccw75
    Member
    Posted 16 years ago #

    i have 5 sidebar. sidebar 1 -> 5. 4 sidebars can fit nicely in the sidebar arrangement. the 5th sidebar goes over the side.
    I'm not sure as to which part of the code i should change so that the 5th sidebar will be in the next row or beneath the first 4 sidebars.
    i have looked into the widget.php and did some modification but not of it works.
    if you are not sure what i'm meant i can post a pic later.

  2. drmike
    Member
    Posted 16 years ago #

    How about a link to see what you're doing and the *.php files made into *.txt files so we can see the code? A pic won't do any good I'm afraid.

  3. wccw75
    Member
    Posted 16 years ago #

    this is the link to the picture.
    http://ifs1.imagefly.info/i/a0/sidebarwidgets.jpg

    the php file is the function.php
    which is located in all widgetized theme. as you can see below I have create quite a number of sidebars. These sidebars will work anywhere. I don't have any problem with that.
    The thing is when you go to the the Presentation Page -> Sidebar Widgets
    All the sidebars will be lined up in a row, how can I move some of those to a second row. You can try it yourself by making more than 4 sidebars and you will understand what I'm trying to do.

    if ( function_exists('register_sidebars') )
    register_sidebar(array(
    'name' => 'Left SideBar',
    'before_widget' => '

  4. ',
    'after_widget' => '
  5. ',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Right SideBar',
    'before_widget' => '

  6. ',
    'after_widget' => '
  7. ',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'PostBar1',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'PostBar2',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Dummy Bar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Header Bar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Footer Bar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));

    Thanks

  • wccw75
    Member
    Posted 16 years ago #

    any help?

  • msheu
    Member
    Posted 16 years ago #

    Looks like you are talking about the widget management page on admin. I don't currently have a version of MU/Widgets installed so I can't give you specifics. But, this should be just a case of CSS editing. On the admin page, figure out the id/class of the widget containers. Then in the admin/widget CSS set some widths and float the containers left. Again, sorry for lack of details on this.

  • wccw75
    Member
    Posted 16 years ago #

    yes, its the widget management page i'm talking about.
    i'll check the css width for that and see if I can manage to fix it. will do an update if i could do it...

  • wccw75
    Member
    Posted 16 years ago #

    how do i actually make it to two rows? i'm not too good with css.

    This is the part where d code does the listing of sidebar widgets
    ***********************************************************
    <div id="zones">
    <?php $i = 1; foreach ( $registered_sidebars as $index => $sidebar ) : ?>
    <input type="hidden" id="<?php echo $index; ?>order" name="<?php echo $index; ?>order" value="" />
    <div class="dropzone">
    <h3><?php echo $sidebar['name']; ?></h3>
    <div id="<?php echo $index; ?>placematt" class="module placematt"><span class="handle"><h4><?php _e('Default Sidebar'); ?></h4><?php _e('Your theme will display its usual sidebar when this box is empty. Dragging widgets into this box will replace the usual sidebar with your customized sidebar.'); ?></span></div>
    <ul id="<?php echo $index; ?>"><?php if ( is_array($sidebars_widgets[$index]) ) foreach ( $sidebars_widgets[$index] as $name ) widget_draggable($name); ?>
    </div>
    <?php endforeach; ?>
    <br class="clear" />
    </div>
    ***********************************************************

    This is the css for zones and dropzone
    ***********************************************************
    #sbadmin #zones {
    width: <?php echo $width; ?>px;
    -moz-user-select: none;
    -khtml-user-select: none;
    user-select: none;
    }
    .dropzone {
    float: left;
    margin-right: 10px;
    padding: 5px;
    border: 1px solid #bbb;
    background-color: #f0f8ff;
    }
    .dropzone h3 {
    text-align: center;
    color: #333;
    }
    .dropzone ul {
    list-style-type: none;
    width: 240px;
    height: <?php echo $height; ?>px;
    float: left;
    margin: 0;
    padding: 0;
    }
    ***********************************************************

  • wccw75
    Member
    Posted 16 years ago #

    i can't get it to second row, so i just shrink the size. i guess that is just a walk around thru it.
    if somone could help me in making it to a second row, tht would be good.

  • anghol
    Member
    Posted 16 years ago #

    I am running into the same problem with my sidebars.
    Were you able to get your sidebars onto two rows?

  • DamienB
    Member
    Posted 16 years ago #

    This works for me (using Firefox):

    I'm not a css genius - so there may be a more universal hack.

    I added an additional <div> tag to the wp-admin/widgets.php page and set it's width in wp-admin/widgets.css.

    Like so:
    In wp-admin/widgets.php after
    (line 307) <div id="zones">

    add
    <div class="dropzone_width">

    or name the class whatever you like.

    Add the closing </div> tag just above
    <br class="clear" />
    around line 338.

    Now set the width by adding

    .dropzone_width{
    width: 1200px;
    }

    in the wp-admin/widgets.css file.

  • DamienB
    Member
    Posted 16 years ago #

    Creating two rows of sidebars creates another problem, If you want to drag a widget from the palette at the bottom to a sidebar off the top of the screen, the screen won't scroll to allow you to get there.

    -So-

    a simple fix for this is to create a table with 1 row and two columns in wp-admin/widgets.php - 1 column w/ 25% width and the other 75%.

    Place the widgets pallette code (surrounded by <div id="palettediv">) in the first column and the sidebar code (surrounded by <div id="zones">) in the second..

    If you have so many sidebars that it creates three or more rows, then we may have to find another fix...

  • wccw75
    Member
    Posted 16 years ago #

    i'll try this out. what i did was just mod the css to make things smaller. still working on the css.

  • About this Topic