esc_html__('Your network’s latest books.', 'aldine') ]); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { $number = (! empty($instance['number'])) ? absint($instance['number']) : 3; if (!$number) { $number = 3; } if (empty($instance['title'])) { $instance['title'] = __('Latest Books', 'aldine'); } echo $args['before_widget']; echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; $books = wp_remote_get(home_url('/wp-json/pressbooks/v2/books')); $books = json_decode($books['body'], true); echo '