/** * 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) { // get the current post global $post; if (isset($post->post_content)) { // check the post content for the short code if (strpos($post->post_content, '[ESPRESSO_NEW_ADDON') === FALSE) { EED_New_Addon::$shortcode_active = TRUE; // Before widget (defined by themes). echo $args['before_widget']; // Title of widget (before and after defined by themes). $title = apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } // load scripts EE_New_Addon::instance()->enqueue_scripts(); // settings $attributes = array(); echo EE_New_Addon::instance()->display_new_addon($attributes); // After widget (defined by themes). echo $args['after_widget']; } } }