Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » New Versions, & Updating »

[SOLVED] Change the cell width in new widget area


  #1  
Old Jul 15, 2009, 09:30 PM
duping812
 
12 posts · Feb 2009
Thanks Flynn for the great update on the new widget function, now I can create my page menu bar and
feed subscribe icons in the same line.

This is what I defined for the new widget in header,
PHP Code:
<?php bfa_widget_area('name=myheader&cells=2&align_1=9&width_1=800&align_2=3&width_2=250'); ?>
The first cell I use PixoPoint Multi-level Navigation Plugin to create stylish menus, and the second cell to place feed subscribe icons. But the width parameters of two cells are not pass to the final code, they equal to half of the maximum width 1050.

You can check the result at my blog, http://thdp.org/
Could you tell me what's wrong with this?

Thanks,

Last edited by duping812; Jul 16, 2009 at 07:20 PM.
  #2  
Old Jul 16, 2009, 10:46 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
A bug, thanks. To correct it in 3.4.2, replace the whole bfa_widget_area function from line 308-362 in functions.php with this:

This adds the width parameter which was missing, adds the missing <tr> ... </tr>, and displays a <DIV> instead of a table, if there's only 1 widget cell.

PHP Code:
function bfa_widget_area($args '') {
    
$defaults = array(
        
'cells' => 1,
        
'align' => 2,
        
'before_widget' => '<div id="%1$s" class="widget %2$s">',
        
'after_widget' => '</div>',
        
'before_title' => '<div class="widget-title"><h3>',
        
'after_title' => '</h3></div>',
    );
    
    
$r wp_parse_args$args$defaults );
    
extract$rEXTR_SKIP );

    
$area_id strtolower(str_ireplace(" ""_"$r['name']));
    
    
// If there are more than 1 cell, use a table, otherwise just a DIV:
    
if ( $r['cells'] > ) {
    
        echo 
'<table id="' $area_id '" class="bfa_widget_area" style="table-layout:fixed;width:100%" cellpadding="0" cellspacing="0" border="0">';

        
// If a width was set for any of the widget area cells:
        
if ( strpos($args,'width_') !== FALSE ) {
            echo 
"\n<colgroup>";
            for ( 
$i 1$i <= $r['cells']; $i++ ) {
                echo 
'<col';
                
$current_width "width_" $i;
                if ( 
$r[$current_width] ) {
                    echo 
' style="width:' $r[$current_width] . 'px"';
                }
                echo 
' />';
            }
            echo 
"</colgroup>";
        }
        
        echo 
"<tr>";
        
        for ( 
$i 1$i <= $r['cells']; $i++ ) {
            
                
$current_name $r['name'] . ' ' $i;
                
$current_id $area_id '_' $i;
                
$current_align "align_" $i;
                
                echo 
"\n" '<td id="' $current_id .'" ';
                
                if ( 
$r[$current_align] ) { 
                    
$align_type $r["$current_align"];
                } else {
                    
$align_type $r['align'];
                }
                
                echo 
bfa_table_cell_align($align_type) . ">";
                
                
// Register widget area
                #$bfa_ata_widget_areas[] = $current_name; 
                  
$bfa_ata_widget_areas[] = array(
                      
"name" => $current_name,
                      
"before_widget" => $r['before_widget'],
                      
"after_widget" => $r['after_widget'],
                      
"before_title" => $r['before_title'],
                      
"after_title" => $r['after_title']
                      );
          
                   
// Display widget area
                
dynamic_sidebar("$current_name"); 
                
                echo 
"\n</td>";
            
        }
        
        echo 
"\n</tr></table>";     
    
    } else {
    
        
// If only 1 widget cell, use a DIV instead of a table
        
echo '<div id="' $area_id '" class="bfa_widget_area">';
        
        
// Add new widget area to existing ones
        
$bfa_ata_widget_areas[] = array(
            
"name" => $r['name'],
            
"before_widget" => $r['before_widget'],
            
"after_widget" => $r['after_widget'],
            
"before_title" => $r['before_title'],
            
"after_title" => $r['after_title']
            );

        
// Display widget area
        
dynamic_sidebar($r['name']);     

        echo 
'</div>';
    
    }
    
    
update_option("bfa_widget_areas"$bfa_ata_widget_areas);


Additionally add this at HTML/CSS Inserts:

HTML Code:
table.bfa_widget_area td {
text-align: left;
}
Otherwise the text inside widgets will be centered, if the widget cell is centered


All of the above will be included in 3.4.3
  #3  
Old Jul 16, 2009, 07:19 PM
duping812
 
12 posts · Feb 2009
Thanks for a such reply.
Prob solved, not it works perfectly. I even included search form in the menu bar.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
change the color of the space outside of the content area fcitino Atahualpa 3 Wordpress theme 13 Nov 16, 2009 06:46 AM
rounding off corners on cell boarders nickcee Atahualpa 3 Wordpress theme 2 Jun 12, 2009 05:29 AM
Problem with widget width and sidebars in Explorer conon Sidebars & Widgets 2 Apr 6, 2009 07:22 AM
Width of widget in Sidebar HalfWayThere Sidebars & Widgets 4 Feb 18, 2009 07:07 PM
Sidebar Width Won't Change bseppa Sidebars & Widgets 1 Dec 13, 2008 01:00 PM


All times are GMT -6. The time now is 03:19 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.