blog

Making Your First WordPress Widget


Sidebars were one of the oldest features of WordPress as a publishing platform, and widgets have been in WordPress for years. This little quick guide walks through the process of making your own widget. Why would you want to?

  • Your mortgage-selling client wants a little simple calculator widget in their sidebar
  • You want to show a subset of content in a customized way
  • You just want to put some markup that WordPress’s stock “Text Widget” always feels like it might eat on you
  • Because learning is valuable even when it doesn’t have concrete purpose immediately ;p

If any of those reasons, or something else, applies to you, this video will explain to you the basic process of extending a WP_Widget class and making sure WordPress lets you put that widget somewhere. (Higher level feature of widgets — like form fields — will be in a future Quick Guide if there is demand.)

Check out the video:

; echo $args['before_title'] . apply_filters( 'widget_title', 'Quick Guide Widget' ) . $args['after_title']; echo esc_html__( 'Hello, World!', 'text_domain' ); echo $args['after_widget']; } } add_action( 'widgets_init', function(){ register_widget( 'QG_Widget' ); });

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2017 'Null Shop;.

To Top