Putting a wordpress custom post into a widget
You will need a “form” and an “update” method for your widget class. function form($instance) { $instance = wp_parse_args( (array) $instance, array (‘show’) ); $show = (!empty($instance[‘show’])) ? $instance[‘show’] : ”; echo ‘<input type=”text” name=”‘.$this->get_field_name(‘show’).'” value=”‘.esc_attr($show).'” />’; } function update($new_instance, $old_instance) { $instance = $old_instance; $instance[‘show’] = ($new_instance[‘show’]) ? $new_instance[‘show’] : 1; return $instance; } … Read more