• Resolved b-rad

    (@b-rad)


    Are there any good tutorials on how to write a simple widget for a WP multisite installation? So far everything I’ve found has been lacking. I haven’t even been able to get sample widget code to show up on the available widgets page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Its the exact same process for writing a widget for a single site. Exactly.

    Thread Starter b-rad

    (@b-rad)

    Hmmm, I wonder why I can’t get any examples to show up in my available widgets list. One tutorial said to use:

    class My_Widget extends WP_Widget {
        function My_Widget() {
            // widget actual processes
        }
    
        function form($instance) {
            // outputs the options form on admin
        }
    
        function update($new_instance, $old_instance) {
            // processes widget options to be saved
        }
    
        function widget($args, $instance) {
            // outputs the content of the widget
        }
    
    }
    register_widget('My_Widget');

    and save the php file in my wp-content/plugins folder which I did but it doesn’t show up anywhere (yes I know the plugin doesn’t do anything but I’m setting my sights low and trying to just get it to show up first).

    and save the php file in my wp-content/plugins folder which I did but it doesn’t show up

    does it show up in the plugins listing and did you activate it?

    Did you include a plugin header in your file?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Stupid question – Did you activate the plugin on the site?

    Thread Starter b-rad

    (@b-rad)

    Not a stupid question. Yes and no actually. A few of the tuts I had found neglected to create the proper header which prevented it from showing up anywhere. Once I had a good header in there it showed up under plugins so then I could activate it and head over to the widgets list where it showed up. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Tutorial for writing a widget for multisite’ is closed to new replies.