Viewing 6 replies - 1 through 6 (of 6 total)
  • I think the Widget Logic plugin should do what you want.

    Just use the !is_page(); tag for the test.

    Thread Starter mizanulkabir

    (@mizanulkabir)

    when i activate the plugin,it shows the following error

    Fatal error: Call to undefined function is_posts() in /home/pepdealc/public_html/wp-content/plugins/widget-logic/widget_logic.php(169) : eval()’d code on line 1

    how to fix it?

    thanks

    Did this show up just when you activated the plugin? Or when you actually put the widget logic code that vtxyzzy mentioned into a widgeT?

    In the error message you posted, is_posts() is not a valid function.

    I suspect that you are trying to use that when you set the widget logic in the Widgets panel. Please use this instead:

    !is_page()

    Thread Starter mizanulkabir

    (@mizanulkabir)

    when i activate the plugin,the errors occurs.

    I am not sure which plugin is best… but to do it by hand, open your sidebar.php file, if you haven’t changed the graphene theme’s sidebar, it should be lines 18 and 19.

    Line 18 is an if statement… if(!is_front_page() && is_active_sidebar…)

    Line 19 should be: dynamic_sidebar(‘sidebar-widget-area’);
    Comment the line out //dynamic_sidebar(‘sidebar-widget-area’);

    Below it, add: (edited)

    if ( is_page() && is_active_sidebar('pages-widget-area') ) { dynamic_sidebar('pages-widget-area'); }
    
    if ( is_single() && is_active_sidebar('posts-widget-area') ) { dynamic_sidebar('posts-widget-area'); }

    Then open the functions.php file, about midway down is the function: graphene_widgets_init()

    Just above the first register_sidebar, add the lines below:

    register_sidebar(array('name' => 'Pages Widget Area' , 'id' => 'pages-widget-area' , 'description' => 'Define Widgets' , 'before_widget' => '<div id="%1$s" class="sidebar-wrap clearfix %2$s">' , 'after_widget' => '</div>' , 'before_title' => '<h3>' , 'after_title' => '</h3>',));
    
    register_sidebar(array('name' => 'Posts Widget Area' , 'id' => 'posts-widget-area' , 'description' => 'Define Widgets' , 'before_widget' => '<div id="%1$s" class="sidebar-wrap clearfix %2$s">' , 'after_widget' => '</div>' , 'before_title' => '<h3>' , 'after_title' => '</h3>',));

    And if that all works… you should have two new widgets in the Appearance admin, named Pages Widget Area and Posts Widget Area.

    ~Chris

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘how to hide specific widget in pages’ is closed to new replies.