__( 'Add content recomendations to your site.', 'algorithmia_widget_domain' ), ) ); } // Creating widget front-end. public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); // Before and after widget arguments are defined by themes. echo $args['before_widget']; if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; // Set the default value and then attempt to load the correct data. echo __( 'No recommendations at this time.', 'algorithmia_widget_domain' ); } // This is the Algorithmia API key. $api_key = $instance['api_key']; // We need the site name to prevent the display of the site name in the links that the Algorithmia API returns. // Algorithmia API expects this as the content value in the meta tag. We pass this below. $site_name = get_bloginfo('name', 'raw'); if ( ! empty( $api_key ) ) { echo '
'; echo $args['after_widget']; } } // Widget form. public function form( $instance ) { $api_key = ''; if ( isset( $instance[ 'title' ] ) ) { $title = $instance[ 'title' ]; } else { $title = __( 'widget_title', 'algorithmia_widget_domain' ); } if ( isset($instance['api_key']) ) { $api_key = $instance['api_key']; } // Widget admin form ?>