WordPress.org

Forums

How to use wp_register_widget_control and wp_register_sidebar_widget (3 posts)

  1. nischalmaniar
    Member
    Posted 2 years ago #

    I am creating a theme where I am allowing users to add twitter widget. But issue is, wordpress is complaining about "register_sidebar_widget" and "register_widget_control" functions and asking me to use wp_register_sidebar_widget and wp_register_widget_control.
    I changed my functions to wp_register_sidebar_widget and wp_register_widget_control. But now I do not see the control fields on the widget

    Here is the code for wp_register_widget_control call back function

    function twitter_control() {
    if(isset($_POST['twitter_submit'])) {
    $options['twitter_title']
    update_option('theme_options',$options);
    }
    echo '<form name="twitter_control_form" id="twitter_control_form" method="post">'."\n";
    echo '<p><label>Twitter</label></p>';
    echo '<p><input type="text" name="twitter_title" id="twitter_title" value="'.$options['twitter_title'].'"/></p>';
    echo '<p><label>Twitter Username</label></p>';
    echo '<p><input type="text" name="twitter_username" id="twitter_username" value="'.$options['twitter_username'].'"/></p>';
    echo '<p><label>Twitter Count</label></p>';
    echo '<p><input type="text" name="twitter_count" id="twitter_count" value="'.$options['twitter_count'].'" /></p>';
    echo '<p><input type="submit" name="twitter_submit" id="twitter_submit" value="Save Changes" /></p>'."\n";
    echo '</form>'."\n";
    }

    Can somebody help, I tried to look for examples over the web, but couldn't find one. There is hardly any documentation available for wp_register_sidebar_widget and wp_register_widget_control :(

  2. Luis zuno
    Member
    Posted 2 years ago #

    Try this

    wp_register_widget_control(
    'ansimuz_tweet', // your unique widget id
    'Tweet', // widget name
    'tweet_control' // Callback function
    );

  3. styledev
    Member
    Posted 1 year ago #

    er. wrong post.

Topic Closed

This topic has been closed to new replies.

About this Topic