public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); $user = $instance['user']; $num = $instance['num']; // before and after widget arguments are defined by themes ?> <!-- aqui comença el widget --> <?php echo $args['before_widget']; ?> <?php if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } ?> <!-- inici fotos instagram --> <?php $fotos = instagram_get_photos($user, $num); if (!$fotos) { print "Username not defined"; } foreach ($fotos->data as $foto) { ?> <a href='<?php print $foto->link; ?> '> <img src='<?php print $foto->images->thumbnail->url; ?> ' title='<?php print htmlspecialchars($foto->caption->text, ENT_QUOTES); ?> ' alt='<?php print $foto->caption->text; ?> '> </a> <?php } ?> <!-- fi fotos instagram --> <?php echo $args['after_widget']; ?> <!-- final del widget --> <?php }
//configuration data require "config.php"; require "instagram-api.php"; $username = "******"; ?> <!doctype html> <html> <meta charset="utf-8"> <body> <h1>Fotos per l'usuari <?php print $username; ?> </h1> <?php $fotos = instagram_get_photos($username); ?> <?php foreach ($fotos->data as $foto) { ?> <li> <a href='<?php print $foto->link; ?> '> <img src='<?php print $foto->images->thumbnail->url; ?> '> </a>