WordPress.org

Ready to get started?Download WordPress

Forums

YouTube widget
bug patch to avoid deprecated function (1 post)

  1. msenate
    Member
    Posted 1 year ago #

    Despite the new version on github https://github.com/lavoiesl/wp-youtube-widget here's a patch to avoid the deprecated register_sidebar_widget and register_widget_control functions.

    So, in case you're stuck with this plugin, apply these changes:

    Index: youtube-widget/youtube.php
    ===================================================================
    --- youtube-widget/youtube.php	(revision 3411)
    +++ youtube-widget/youtube.php	(working copy)
    @@ -24,7 +24,7 @@
    
     	// Check for the required plugin functions. This will prevent fatal
     	// errors occurring when you deactivate the dynamic-sidebar plugin.
    -	if ( !function_exists('register_sidebar_widget') )
    +	if ( !function_exists('wp_register_sidebar_widget') )
     		return;
    
     	// This is the function that outputs our little Google search form.
    @@ -156,11 +156,11 @@
    
     	// This registers our widget so it appears with the other available
     	// widgets and can be dragged and dropped into any active sidebars.
    -	register_sidebar_widget(array('YouTube', 'widgets'), 'widget_youtube');
    +	wp_register_sidebar_widget('widget_youtube', array('YouTube', 'widgets'), 'widget_youtube');
    
     	// This registers our optional widget control form. Because of this
     	// our widget will have a button that reveals a 300x100 pixel form.
    -	register_widget_control(array('YouTube', 'widgets'), 'widget_youtube_control', 300, 200);
    +	wp_register_widget_control('widget_youtube_control', array('YouTube', 'widgets'), 'widget_youtube_control', 300, 200);
     }
    
     // Run our code later in case this loads prior to any required plugins.

    http://wordpress.org/extend/plugins/youtube-widget/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic