'; if(!isset($atts['after_wrapper'])) $atts['after_wrapper'] = ''; if(!isset($atts['before_image_listing'])) $atts['before_image_listing'] = '
  • '; if(!isset($atts['after_image_listing'])) $atts['after_image_listing'] = '
  • '; if(!isset($atts['before_caption'])) $atts['before_caption'] = '

    '; if(!isset($atts['after_caption'])) $atts['after_caption'] = '

    '; if(!isset($atts['theme'])) $atts['theme'] = 'theme1'; if(isset($atts['access_token'])){ $access_token=$atts['access_token']; $json_link="https://api.instagram.com/v1/users/self/media/recent/?"; $json_link.="access_token={$access_token}&count={$photo_count}"; $json = file_get_contents($json_link); $obj = json_decode(preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $json), true); $output = ''; //Wrapper Start echo '
    '; echo $atts['before_wrapper']; foreach ($obj['data'] as $post) { /*echo '
    ';
    			print_r($post);
    			echo '
    ';*/ $image_size = $atts['image_size']; $pic_text=$post['caption']['text']; $pic_link=$post['link']; $pic_like_count=$post['likes']['count']; $pic_comment_count=$post['comments']['count']; $pic_src=str_replace("http://", "https://", $post['images'][$image_size]['url']); $pic_created_time=date("F j, Y", $post['caption']['created_time']); $pic_created_time=date("F j, Y", strtotime($pic_created_time . " +1 days")); //Image Listing Start echo $atts['before_image_listing']; echo ""; echo '
    '; echo "{$pic_text}"; echo $atts['before_caption']."{$pic_text}".$atts['after_caption']; echo '
    '; echo ''.$pic_like_count.'  '.$pic_comment_count; echo '
    '; echo '
    '; echo "
    "; echo $atts['after_image_listing']; //Image Listing End } echo $atts['after_wrapper']; echo '
    '; //Wrapper End wp_enqueue_style( 'twaic-fontawesome', 'https://use.fontawesome.com/releases/v4.6.3/css/font-awesome-css.min.css', array(), '4.6.3' ); if($atts['theme']=="theme1"){ wp_enqueue_style( 'twaic-theme1', plugins_url('asset/css/theme1.css',__FILE__ ), array(), TWABC_VERSION ); } } else{ echo '
    Please, configure your Instagram settings first.
    '; } // Collect the output $output = ob_get_contents(); ob_end_clean(); return $output; }