'widget_dpa_featured_achievement', 'description' => __( 'Display details of a single achievement.', 'dpa' ), ) ); parent::__construct( false, __( '(Achievements) Featured Achievement', 'dpa' ), $widget_ops ); } /** * Register the widget * * @since Achievements (3.3) */ static public function register_widget() { register_widget( 'DPA_Featured_Achievement_Widget' ); } /** * Displays the output * * @param array $args * @param array $instance * @since Achievements (3.3) */ public function widget( $args, $instance ) { $settings = $this->parse_settings( $instance ); $settings['post_id'] = absint( apply_filters( 'dpa_featured_achievement_post_id', $settings['post_id'], $instance, $this->id_base ) ); // Get the specified achievement $achievement = get_posts( array( 'no_found_rows' => true, 'numberposts' => 1, 'p' => $settings['post_id'], 'post_status' => 'publish', 'post_type' => dpa_get_achievement_post_type(), 'suppress_filters' => false, ) ); // Bail if it doesn't exist if ( empty( $achievement ) ) return; $achievement = array_shift( $achievement ); $title = dpa_get_achievement_title( $achievement->ID ); echo $args['before_widget']; echo $args['before_title'] . $title . $args['after_title']; if ( has_post_thumbnail( $achievement->ID ) ) : ?> ID, 'thumbnail', array( 'alt' => $title ) ); ?> parse_settings( $instance ); ?>
0, ), 'featured_achievement_widget_settings' ); } }