Options page for widget

Your widget is part of a plugin (per the first sentence of the question), so what you are really talking about is making a plugin administration page, which you would do with add_menu_page, add_submenu_page, or one of the more specialize menu page functions. That is the nutshell version of the answer. There are a lot … Read more

Neaten content — different widget or CSS change?

You could add this to your CSS: div.textwidget { max-width: 250px; } You would probably want to make sure that’s above your media query rules so that it doesn’t affect the formatting of your page on smaller screens. I used Chrome’s developer console to find out how wide the text inputs are and to find … Read more

How to show widget in frontend?

Your widget method does not echo anything. If you want content to show up the widget needs to echo content. function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ if(isset($instance)) { if( isset( $instance[ ‘title’ ] ) ) { $title = apply_filters( ‘widget_title’, $instance[ ‘title’ ] ); … Read more

Help me tidy up my widget code

Your Class Name: I’d prefix the class name to make collisions less likely– something like Your_Initials_Today_Video, or namespace it, but be aware that PHP namespacing requires a higher versions of PHP than WordPress requires. That could cause issues. Your Constructor: You can use __construct instead of Today_video for your constructor. WordPress no longer supports PHP … Read more