WordPress.org

Ready to get started?Download WordPress

Forums

Allow widgets to be added into multiple sidebars (1 post)

  1. ch3nyong
    Member
    Posted 5 years ago #

    Hi all,

    I am in the middle of developing plugin and widget in the correct way.

    After asking Google for a while, I realised that having plugin widgetized can be as easy as registering them:

    $widget_ops = array('classname' => 'the_class_name', 'description' => __( "the_description") );
    wp_register_sidebar_widget('thewidget', 'the_widget_name', 'the_function_name', $widget_ops);

    (in this case, using register_sidebar_widget or wp_register_sidebar_widget does not matter, although I know there are some debates on which to use)

    However, I later realized that by registering so, I can only use the widget once in all of the sidebar.

    Now that I have multiple sidebars defined, and I want to add the widget to all of the sidebars. How?

    I realised that Text widget is doing exactly the same thing that I want to achieve here. But bear with me that I am not a Pro, I found that it is way too confusing for me @@ (especially the widget name Text and the field name text, argh..)

    Wonder if any of you have a simple sample or demo on this? I've tried asking Google this but Google didnt really answering me properly :s

    Thanks!!

Topic Closed

This topic has been closed to new replies.

About this Topic