开发者

How to Customize the Widgets in Wordpress

开发者 https://www.devze.com 2023-03-08 22:41 出处:网络
i want to remove some of the Widget Areas in Appearance/Widgets. I want to remove the \"Primary Widget Area\", the \"Secondary Widget Area\" and the \"Fourth Footer Widget Area\", so that the User onl

i want to remove some of the Widget Areas in Appearance/Widgets. I want to remove the "Primary Widget Area", the "Secondary Widget Area" and the "Fourth Footer Widget Area", so that the User only can see The three other Foot开发者_如何学编程er Widget Areas in Appearance/Widgets.

Is there a way to do this?

Second Question is, how can i just allow 1 Widget per Area. So that the User just can add only 1 Widget to a several Widget Area of the three that i want to show in Appearance/Widgets?

Thx, Jings


The widget areas are assigned in your theme's functions.php. You should find something along the lines of:

function the_widgets_init() {
    if ( !function_exists('register_sidebars') )
    return;
        register_sidebars(1,array('name' => 'Primary Widget Area',
        'before_widget' => '<div class="sidebar-item widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h2 class="widgettitle">','after_title' => '</h2>'));
        // ...
        // several instances of the above
        // ...
    }
add_action( 'init', 'the_widgets_init' );

Delete whatever widget areas you want to get rid of.

Also, I'm fairly certain that you cannot limit the number of widgets per area unless you're willing to screw with the wordpress core (which is not advisable and would be overwritten with every update).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号