true, ) ); } // The widget form (for the backend ) public function form($instance) { // Set widget defaults $defaults = array( 'title' => '', 'description' => '', 'results' => ANNFU_CAROUSEL_RESULTS, 'results_per_page' => ANNFU_CAROUSEL_RESULTS_PER_PAGE, ); // Parse current settings with defaults extract(wp_parse_args(( array )$instance, $defaults)); ?>

'; if ($title) { echo $before_title . $title . $after_title; } // Display textarea field if ($description) { echo '

' . $description . '

'; } $response = wp_remote_get(ANNFU_SITE . '/v2/annunci?limit=' . $results . '&onoranza_funebre_id=' . get_option('annfu_onoranza_funebre_id'), array('sslverify' => false)); $r = json_decode(wp_remote_retrieve_body($response), true); if (is_array($r) && count($r['data']) > 0) { echo '
'; echo '
'; echo ''; echo '
'; echo '
'; } else { echo '

Nessun annuncio disponibile

'; } echo ''; // WordPress core after_widget hook (always include ) echo $after_widget; } } // Register the widget function annfu_widget() { register_widget('Annfu_Widget'); }