Suporte » Ajustando o WordPress » Fotos Instagram não aparecem
Fotos Instagram não aparecem
-
A integração do Instagram com o site http://www.asemana.com.br parou de funciona ha algum tempo e eu nem imagino o que aconteceu. (Era para aparecer as fotos no rodapé do site)
Plugin:
Instagram-Widget-for-WordPress
Desativar | EditarThis plugin get a users recent images, up to 10, and displays them in a WordPress Widget. It will also display likes and comments if uplaoded with the images.
Versão 1.3.1 | Por David Register | Visitar o site do plugin
-
Bom dia,
está mostrando o erro “The user currently does not have any images…”
o usuário está correto e integrado à API do instagram?
Sou novo no WordPress, não consigo achar onde estão as informações do usuário e a integração!! Pode me ajudar?
Olá,
Você deve procurar dentro do administrador na lista dos plugins algum que tenha relação com o feed do instagram e clicar em configurações (ou settings).
Caso encontre, envie um print da tela das configurações para que eu possa tentar ajudar. =)
Só achei duas coisas, essa imagem e o código que vou colocar abaixo para edição do plugin.
<?php /* Plugin Name: Instagram-Widget-for-WordPress Plugin URI: http://davidmregister.com/instagram-widget-for-wordpress Description: This plugin get a users recent images, up to 10, and displays them in a WordPress Widget. It will also display likes and comments if uplaoded with the images. Version: 1.3.1 Author: David Register Author URI: http://davidmregister.com License: GPL2 */ /** * Instagrm_Feed_Widget Class */ class Instagrm_Feed_Widget extends WP_Widget { /** constructor */ function __construct() { parent::WP_Widget( /* Base ID */'instagrm_widget', /* Name */'Instagram Widget for WordPress', array( 'description' => 'A widget to display a users instagrm feed' ) ); } /* WP_Widget::widget */ function widget( $args, $instance ) { extract( $args ); //get widget information to display on page $title = apply_filters( 'widget_title', $instance['title'] ); $user_id = apply_filters( 'widget_title', $instance['user_id'] ); $access_token = apply_filters( 'widget_title', $instance['access_token'] ); $picture_number = apply_filters( 'widget_title', $instance['picture_number'] ); $picture_size = apply_filters( 'widget_title', $instance['picture_size'] ); $link_images = apply_filters( 'widget_title', $instance['link_images'] ); $show_likes = apply_filters( 'widget_title', $instance['show_likes'] ); $show_caption = apply_filters( 'widget_title', $instance['show_caption'] ); $debug_mode = apply_filters( 'widget_title', $instance['debug_mode'] ); echo $before_widget; if ( $title ){ echo $before_username ."<h2 class='gentesque' id='instagram_widget_title'>". $title ."</h2>". $after_username; }; if($debug_mode){ // Check requirements if (extension_loaded('curl')){ $curl_ver = curl_version(); echo '<p>Curl is <b>Enabled</b></p>'; echo '<p>Curl Version Number:'.$curl_ver['version_number'].'</p>'; echo '<p>User ID:'.$user_id.'</p>'; echo '<p>Access Token:<span style="word-wrap:break-word;width:100px;">'.$access_token.'</span></p>'; $results = $this->get_recent_data($user_id,$access_token); echo '<p><b>Results</b>:</p>'; foreach($results->meta as $key => $val){ echo "<p>".$key.": ".$val."</p>"; } }else{ echo '<p>Curl is <b>NOT</b> Enabled</p>'; } return; } ?> <style> .instagram_likes,.instagram_caption{ margin-bottom: 0px !important; } #instagram_widget li{ margin-bottom: 10px; } </style> <?php $results = $this->get_recent_data($user_id,$access_token); $i=1; echo "<ul id='instagram_widget'>"; if(!empty($results->data)){ foreach($results->data as $item){ if($picture_number == 0){ echo "<strong>Please set the Number of images to show within the widget</strong>"; break; } echo " <li>"; if(!empty($link_images)){ echo "<a>link."' target='_blank'><img src='".$item->images->$picture_size->url."' alt='".$title." image'/></a>"; }else{ echo "<img src='".$item->images->$picture_size->url."' alt=''/>"; } if($show_likes){ if(!empty($item->likes->count)){ echo "<p class='instagram_likes'>Likes: <span class='likes_count'>".$item->likes->count."</span></p>"; } } if($show_caption){ if(!empty($item->caption->text)){ echo "<p class='instagram_caption'>".$item->caption->text."</p>"; } } echo "</li> "; if($i == $picture_number){ echo ""; break; }else{ $i++; } } }else{ echo "<strong>The user currently does not have any images...</strong>"; } echo $after_widget; } /* WP_Widget::update */ function update( $new_instance, $old_instance ) { $instance = $old_instance; //update setting with information form widget form $instance['title'] = strip_tags($new_instance['title']); $instance['access_token'] = strip_tags($new_instance['access_token']); $instance['user_id'] = strip_tags($new_instance['user_id']); $instance['picture_number'] = strip_tags($new_instance['picture_number']); $instance['picture_size'] = strip_tags($new_instance['picture_size']); $instance['link_images'] = strip_tags($new_instance['link_images']); $instance['show_likes'] = strip_tags($new_instance['show_likes']); $instance['show_caption'] = strip_tags($new_instance['show_caption']); $instance['debug_mode'] = strip_tags($new_instance['debug_mode']); return $instance; } /* WP_Widget::form */ function form( $instance ) { if ( $instance ) { $title = esc_attr( $instance[ 'title' ] ); $access_token = esc_attr( $instance[ 'access_token' ] ); $user_id = esc_attr( $instance[ 'user_id' ] ); $picture_number = esc_attr( $instance[ 'picture_number' ] ); $picture_size = esc_attr( $instance[ 'picture_size' ] ); $show_likes = esc_attr( $instance[ 'show_likes' ] ); $show_caption = esc_attr( $instance[ 'show_caption' ] ); $link_images = esc_attr( $instance[ 'link_images' ] ); $debug_mode = esc_attr( $instance['debug_mode'] ); } else { $title = __( 'Title', 'text_domain' ); $username = __( 'Username', 'text_domain' ); $access_token = __( 'Access Token', 'text_domain' ); $user_id = __( 'User ID', 'text_domain' ); } $picture_sizes = array('thumbnail' => 'Thumbnail', 'low_resolution' => 'Low Resolution','standard_resolution' => 'Standard Resolution'); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /> </p> <p> <label for="<?php echo $this->get_field_id('user_id'); ?>"><?php _e('User ID:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('user_id'); ?>" name="<?php echo $this->get_field_name('user_id'); ?>" type="text" value="<?php echo $user_id; ?>" /> </p> <p> <label for="<?php echo $this->get_field_id('access_token'); ?>"><?php _e('Access Token:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('access_token'); ?>" name="<?php echo $this->get_field_name('access_token'); ?>" type="text" value="<?php echo $access_token; ?>" /> </p> <p> <label for="<?php echo $this->get_field_id('picture_number'); ?>"><?php _e('Number of Images:'); ?></label> <select id="<?php echo $this->get_field_id('picture_number'); ?>" name="<?php echo $this->get_field_name('picture_number'); ?>"> <option value="0">Select Number</option> <?php for($i=1;$i<11;$i++):?> <option value="<?php echo $i;?>" <?php if($i == $picture_number){echo 'selected="selected"';};?>><?php echo $i;?></option> <?php endfor;?> </select> </p> <p> <label for="<?php echo $this->get_field_id('picture_size'); ?>"><?php _e('Picture Size:'); ?></label> <select id="<?php echo $this->get_field_id('picture_size'); ?>" name="<?php echo $this->get_field_name('picture_size'); ?>"> <?php foreach($picture_sizes as $item => $val):?> <option value="<?php echo $item;?>" <?php if($item == $picture_size){echo 'selected="selected"';};?>><?php echo $val;?></option> <?php endforeach;?> </select> </p> <p> <label for="<?php echo $this->get_field_id('link_images'); ?>"><?php _e('Link images to full image:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('link_images'); ?>" name="<?php echo $this->get_field_name('link_images'); ?>" type="checkbox" <?php echo (($link_images)? "CHECKED":''); ?> /> </p> <p> <label for="<?php echo $this->get_field_id('show_likes'); ?>"><?php _e('Show Likes:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('show_likes'); ?>" name="<?php echo $this->get_field_name('show_likes'); ?>" type="checkbox" <?php echo (($show_likes)? "CHECKED":''); ?> /> </p> <p> <label for="<?php echo $this->get_field_id('show_caption'); ?>"><?php _e('Show Caption:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('show_caption'); ?>" name="<?php echo $this->get_field_name('show_caption'); ?>" type="checkbox" <?php echo (($show_caption)? "CHECKED":''); ?> /> </p> <p> <label for="<?php echo $this->get_field_id('debug_mode'); ?>"><?php _e('Debug Mode:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('debug_mode'); ?>" name="<?php echo $this->get_field_name('debug_mode'); ?>" type="checkbox" <?php echo (($debug_mode)? "CHECKED":''); ?> /> </p> <p>If you do not have a ID or access token, please visit <a href="http://instagram.davidmregister.com/">Get Access token</a> to receive a valid token</p> <?php } function get_recent_data($user_id, $access_token){ //CURL REST API to get users recent photos $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,'https://api.instagram.com/v1/users/'.$user_id.'/media/recent/?access_token='.$access_token); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //execute post $result = curl_exec($ch); //close connection curl_close($ch); $result = json_decode($result); return $result; } } // class Instagrm_Feed_Widget // register Instagrm widget add_action( 'widgets_init', create_function( '', 'register_widget("Instagrm_Feed_Widget");' ) ); ?>
Pronto, na imagem é possível verificar que o id e o token da sua conta do instagram não estão preenchidos.
Voce pode clicar no link bem abaixo (Get access token) e gerar um novo token de acesso fazendo login no instagram para autorizar o plugin.
wiruizfe, quando for postar código utilize aspas investidas.
Luiza você esta me ajudando muito, consegui achar os caminhos aqui…Mas quando eu fui fazer o procedimento no Insta para pegar o Token, olha só a mensagem que aparece!!
Instagram pede para colocar esse link:
com meu id de cliente no lugar do CLIENT-ID, mas o que recebo de resposta é:
{“code”: 400, “error_type”: “OAuthException”, “error_message”: “Redirect URI does not match registered redirect URI”}
Ali onte tem REDIRECT-URl coloque a URL do seu site.
Certo consegui o Token, Inseri todos os dados nos respectivos lugares da imagem, no User ID eu coloquei tanto o login do insta quanto o Client ID e não funcionou nada!!!
Depois tentei pelo código, mas eu não entendo nada de PHP, segue abaixo o que eu fiz:
O código era esse postado em cima, e eu alterei a seguinte parte dele com
/* WP_Widget::form */ function form( $instance ) { if ( $instance ) { $title = esc_attr( $instance[ 'Jornal A Semana' ] ); $access_token = esc_attr( $instance[ '368611750.e41a8af.26de957dc79b495c9ce1dbafa801c428' ] ); $user_id = esc_attr( $instance[ 'jornalasemana' ] ); $picture_number = esc_attr( $instance[ 'picture_number' ] ); $picture_size = esc_attr( $instance[ 'picture_size' ] ); $show_likes = esc_attr( $instance[ 'show_likes' ] ); $show_caption = esc_attr( $instance[ 'show_caption' ] ); $link_images = esc_attr( $instance[ 'link_images' ] ); $debug_mode = esc_attr( $instance['debug_mode'] ); } else { $title = __( 'Jornal A Semana', 'text_domain' ); $username = __( 'jornalasemana', 'text_domain' ); $access_token = __( '368611750.e41a8af.26de957dc79b495c9ce1dbafa801c428', 'text_domain' ); $user_id = __( 'e41a8af0735d46699981103ad59c1df6', 'text_domain' ); }
Mesmo assim, nada!!! Será que preciso alterar mais alguma coisa???
Olá,
Não era pra ser necessário você entrar no código para configurar o plugin.
Você selecionou a quantidade de imagens a serem mostradas?
Pronto ja voltei o código antigo, e selecionei ja a opção de 5 imgs e de 10 imgs e nada!!!
- O tópico ‘Fotos Instagram não aparecem’ está fechado para novas respostas.