• Hi
    I fight with this couple of days.

    My site use theme Fervens c and there is no code in single page to determine number of sidebars.
    Only one place when I can change it is Function.php:

    <?php
    
    if ( function_exists('register_sidebar') )
        register_sidebars(2, array(
            'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-all">',
            'after_widget' => '</div></div>',
            'before_title' => '<h3 class="widgettitle">',
            'after_title' => '</h3>',
        ));

    I want delete one of sidebars in my category ID: 4106
    Now i use code:

    <?php
    $post = $wp_query->post;
    if ( in_category('4106') ) {
    include(TEMPLATEPATH . '/single2.php');
    } else {
    include(TEMPLATEPATH . '/single1.php');
    }
    ?>

    So it check category and I use diffrent template for category ID: 4106 buy still I cant delete one of sidebars

    help guys
    thx

Viewing 3 replies - 1 through 3 (of 3 total)
  • You will likely have code in your sidebar.php file that looks similar to the following:

    <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(2)) : else : ?><?php endif; ?>

    Just “wrap” that code section (or line) with something similar to this:

    <?php if (!in_category('4106')) : ?>
      <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(2)) : else : ?><?php endif; ?>
    <?php endif; ?>

    I believe that will work for you … I did not see the theme you mentioned in the WP repo so I could not test directly.

    Thread Starter marcinpl

    (@marcinpl)

    Thanks Cais – you helped me ??
    But something wrong happend with sidebar on another pages.
    I used this:

    <!–Start Dynamic Sidebar –>
    <?php if (!in_category(‘4106’)) : ?>
    <?php if (function_exists(‘dynamic_sidebar’) && dynamic_sidebar(2)) : else : ?><?php endif; ?>

    but now category page it’s ok but in another pages, sidebar 2 copied to sidebar 1 and I have to similar sidebars.
    ps.
    This code copied widget from sidebar 2 ( not htm from sidebar 2)

    Thread Starter marcinpl

    (@marcinpl)

    Now it’s ok i wrote bad sidebar numer ??
    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Delete One Sidebar in diffrent category – Function.php ?’ is closed to new replies.