Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter viwiv

    (@viwiv)

    Hello,

    1. I am sorry for the spelling mistakes in the title of the question.

    2. I eventually found my personal, but functional solution, to implement the conditional tags in Widgets of my theme under construction. ??

    So my problem is solved.

    Thank you.

    V.

    Thread Starter viwiv

    (@viwiv)

    Ok! Resolved!

    … With replace…

    if (0 < $numtags) $numtags = number_format($numtags , 0, ',', ' ');

    by…

    if (0 < $numtags) $numcats= number_format_i18n($numtags);

    Great!

    V.

    Thread Starter viwiv

    (@viwiv)

    Thanks, Michael.

    V.

    I found the solution in theme “Options” written by Justin Tadlock. To respect copyright, I will not publish the solution here… but it exists!

    Hi,

    These methods are very interesting, but doesn’t work on my side… Due to the 2.7 version of WordPress?

    I use this code in functions.php:

    function is_sidebar_active( $index = 1){
    	$sidebars	= wp_get_sidebars_widgets();
    	$key		= (string) 'sidebar-'.$index;
    
    	return (isset($sidebars[$key]));
    ]
    register_sidebar(array('name'=>'header_right',
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget' => '</li>',
            'before_title' => '<h3 class="widgettitle">',
            'after_title' => '</h3>',
     ));
    register_sidebar(array('name'=>'header_bottom',
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget' => '</li>',
            'before_title' => '<h3 class="widgettitle">',
            'after_title' => '</h3>',
     ));

    I use this code in header.php:

    if ( function_exists('dynamic_sidebar') && is_sidebar_active(1) ) {
    		echo '<ul id="widget_header_right">'. "\n";
    		dynamic_sidebar(1);
    		echo '</ul>'. "\n";
    		}
    		else
    		{
    		}
    ...
    if ( function_exists('dynamic_sidebar') && is_sidebar_active(2) ) {
    		echo '<ul id="widget_header_bottom">'. "\n";
    		dynamic_sidebar(2);
    		echo '</ul>'. "\n";
    		}
    		else
    		{
    		}

    When dynamic-sidebar(2) is empty, ul element displays!

    I check my datatabase in wp-options. Sidebar_widgets displays:

    a:3:{s:9:"sidebar-1";a:1:{i:0;s:6:"images";}s:9:"sidebar-2";a:0:{}s:13:"array_version";i:3;}

    Thanks for your help!!!

    Thread Starter viwiv

    (@viwiv)

    Moshu,

    Thank you very much! ??

    Sincerely,

    Vincent

Viewing 6 replies - 1 through 6 (of 6 total)