Widget Options Not saving

Your problem is that you’re calling the wrong method for generating the name attribute. It should be $this->get_field_name(‘via_cat’) Also, you can use wp_dropdown_categories(), no need to reinvent the wheel: wp_dropdown_categories(array( ‘name’ => $this->get_field_name(‘via_cat’), ‘selected’ => (int)$instance[‘via_cat’], ));

Add filter to blogroll widget

Filter the arguments for the blogroll: add_filter( ‘widget_links_args’, ‘wpse_76521_filter_blogroll’ ); function wpse_76521_filter_blogroll( $args ) { $li_start = isset ( $args[‘before’] ) ? $args[‘before’] : ‘<li>’; $args[‘before’] = $li_start . ‘<i class=”icon-ok”></i>’; return $args; } Explanation The blogroll is created by the widget class WP_Widget_Links. This class calls wp_list_bookmarks() with some prepared widget arguments which we … Read more

Get page IDs based on which template they are using?

WP_Query goes only through posts by default. Try adding page as your post type: $the_query = new WP_Query(array( ‘post_type’ => ‘page’, /* overrides default ‘post’ */ ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘templates/_partner.php’ )); See: WP_Query – Type Parameters

Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?

The cart widget isn’t showing because it’s configured to not show on the cart and checkout page. If you want to change that take a look at class-wc-widget-cart.php, there you find the following line: if ( is_cart() || is_checkout() ) return; Change it to: if ( is_cart() ) return; To show the widget on the … Read more

What is the quickest way to make a widget?

The Widgets API is the quickest way to make a widget that’s reusable. Example use: class My_Widget extends WP_Widget { /** * PHP4 constructor */ function My_Widget() { My_Widget::__construct(); } /** * PHP5 constructor */ function __construct() { // actual widget processes } /** * Echo the settings update form * * @param array $instance … Read more