最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Import Instagram post to Wordpress blog post

programmeradmin0浏览0评论

I'm looking for a way how I can import an Instagram post to a Wordpress post.

So to make it clear: I'm NOT looking for a Instagram Feed plugin. I need to import an Instagram post to a Wordpress blog posts separately.

This is because I need a post loop with multiple categories where one of them is an Instagram post.

So how can I do that? If there is a plugin for this, that will be fine. All suggestions are welcome. I prefer the most simple solution obviously.

Thanks in advance.

I'm looking for a way how I can import an Instagram post to a Wordpress post.

So to make it clear: I'm NOT looking for a Instagram Feed plugin. I need to import an Instagram post to a Wordpress blog posts separately.

This is because I need a post loop with multiple categories where one of them is an Instagram post.

So how can I do that? If there is a plugin for this, that will be fine. All suggestions are welcome. I prefer the most simple solution obviously.

Thanks in advance.

Share Improve this question asked Sep 30, 2019 at 10:59 Thomas TrompThomas Tromp 31 silver badge3 bronze badges 1
  • You need anyway to create an Instagram application for that and build a small API interface. – middlelady Commented Sep 30, 2019 at 11:29
Add a comment  | 

1 Answer 1

Reset to default 2

I'm not currently aware of other ways rather then:

  • Creating an Instagram App
  • Get an access token
  • Build a small API handler

Something like this to put in your functions.php:

function my_instagram()
{
    $transient_key = 'instagram_data';
    $feed_data = get_transient( $transient_key );
    if( false === $feed_data ) {
        $feed_data = json_decode(file_get_contents('https://api.instagram/v1/users/self/media/recent/?access_token=<ACCESS_TOKEN>&count=4'));
        if ( is_array( $feed_data->data ) ) {
            set_transient( $transient_key, $feed_data->data, 60*60*24 );
        }
    }
    return $feed_data;
}

Later of course you can manipulate your $feed_data as you need. Adjust the transient according to your requirements.

It's called feed because it is what it is. I'm afraid though they lately restricted the endpoints. Read more https://www.instagram/developer/endpoints/.

You can generate intagram access tokens here https://instagram.pixelunion/.

发布评论

评论列表(0)

  1. 暂无评论