'; 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['show_user_details'])) $atts['show_user_details'] = '1'; if(isset($atts['access_token'])){ $access_token=$atts['access_token']; /*Profile Details*/ $profile_details = ''; if($atts['show_user_details']==1){ $json_link="https://api.instagram.com/v1/users/self/?"; $json_link.="access_token={$access_token}"; $json = file_get_contents($json_link); $obj = json_decode(preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $json), true); $username= $obj['data']['username']; $profile_picture=$obj['data']['profile_picture']; $full_name=$obj['data']['full_name']; $followed_by=$obj['data']['counts']['followed_by']; $follows=$obj['data']['counts']['follows']; $post_count = $obj['data']['counts']['media']; $profile_details .='
    '; $profile_details .= '
    '.$full_name.'

    @'.$username.'

    '; $profile_details .= '

    '.$post_count.'

    Posts

    '; $profile_details .= '

    '.$followed_by.'

    Followers

    '; $profile_details .= '

    '.$follows.'

    Following

    '; $profile_details .='
    '; $profile_details .='
    '; //twic-profile-details } /*Instagram Feeds*/ $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 $profile_details; 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(), TWAIC_VERSION ); } } else{ echo '
    Please, configure your Instagram settings first.
    '; } // Collect the output $output = ob_get_contents(); ob_end_clean(); return $output; }