Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7834357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:07:51+00:00 2026-06-02T13:07:51+00:00

:) This is the code I’m using right now to pull my entries from

  • 0

🙂
This is the code I’m using right now to pull my entries from Instagram:

        <?php
        setlocale(LC_TIME, 'it_IT');
        function get_instagram($tag=bombacarta,$count=10,$width=612,$height=612){
            $url = 'https://api.instagram.com/v1/tags/'.$tag.'/media/recent/?access_token=13137.f59def8.1a759775695548999504c219ce7b2ecf&count='.$count;
            // Also Perhaps you should cache the results as the instagram API is slow
            $cache = './wp-content/themes/raymond-31/instagram_json/'.sha1($url).'.json';
            if(file_exists($cache) && filemtime($cache) > time() - 500){
                // If a cache file exists, and it is newer than 1 hour, use it
                $jsonData = json_decode(file_get_contents($cache));
            } else {
                $jsonData = json_decode((file_get_contents($url)));
                file_put_contents($cache,json_encode($jsonData));
            }
            $result = '<div style="border-top:1px solid #ddd">'.PHP_EOL;
            foreach ($jsonData->data as $key=>$value) {
                $location = (!empty($value->location->name))?'presso '.$value->location->name:null;
                $result .= "\t".'<em>'.htmlentities($value->caption->text, ENT_QUOTES, "UTF-8").'</em><br /><img src="'.$value->images->standard_resolution->url.'" alt="'.htmlentities($value->caption->text, ENT_QUOTES, "UTF-8").'" width="'.$width.'" height="'.$height.'" /><br /><div class="postinfo">Scattata da '.$value->caption->from->full_name.' il '.htmlentities(gmstrftime('%e %B %Y alle %R', $value->caption->created_time + 7200)).' '.htmlentities($location).'</div><br />'.PHP_EOL;
            }
            $result .= '</div>'.PHP_EOL;
            return $result;
        }
        echo get_instagram();
        ?>

I’d love to have that after 5 entries I can show the others as thumbnails. So I’d like to have 5 enties in standard_resolution and the other.. 10..? 20..? (dunno) as a clickable thumbnail.

Of course I can copy/paste the code again replacing standard_resolution with thumbnail_resolution but how can I specify that I’d like to start from (say) entry 5 instead that entry 0 (to avoid to repeat the same 5 images again before the other ones)? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:07:52+00:00Added an answer on June 2, 2026 at 1:07 pm

    Try this:

      function get_instagram($tag=bombacarta,$count=10,$width=612,$height=612){
                $url = 'https://api.instagram.com/v1/tags/'.$tag.'/media/recent/?access_token=13137.f59def8.1a759775695548999504c219ce7b2ecf&count='.$count;
                // Also Perhaps you should cache the results as the instagram API is slow
                $cache = './wp-content/themes/raymond-31/instagram_json/'.sha1($url).'.json';
                if(file_exists($cache) && filemtime($cache) > time() - 500){
                    // If a cache file exists, and it is newer than 1 hour, use it
                    $jsonData = json_decode(file_get_contents($cache));
                } else {
                    $jsonData = json_decode((file_get_contents($url)));
                    file_put_contents($cache,json_encode($jsonData));
                }
                $result = '<div style="border-top:1px solid #ddd">'.PHP_EOL;
                $ic=0;
                foreach ($jsonData->data as $key=>$value) {
                    $location = (!empty($value->location->name))?'presso '.$value->location->name:null;
    if($ic>=5){$res_c=thumbnail_resolution; $x_data="TESTT";}else{$res_c=standard_resolution;$x_data='Scattata da '.$value->caption->from->full_name.' il '.htmlentities(gmstrftime('%e %B %Y alle %R', $value->caption->created_time + 7200)).' '.htmlentities($location);}
    $ic++;
                    $result .= "\t".'<em>'.htmlentities($value->caption->text, ENT_QUOTES, "UTF-8").'</em><br /><img src="'.$value->images->$res_c->url.'" alt="'.htmlentities($value->caption->text, ENT_QUOTES, "UTF-8").'" width="'.$width.'" height="'.$height.'" /><br /><div class="postinfo">'.$x_data.'</div><br />'.PHP_EOL;
                }
                $result .= '</div>'.PHP_EOL;
                return $result;
            } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This code attempts to dynamically switch the class of the StateContainer div from StateOne
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
This code used to return my local ip address as 192.xxx.x.xxx but now it
This code: $(#permalink a).click(function(id){ var id = this.getAttribute('href'); $(#newPostContent).load(id, function() { $(#removeTrigger).click(function() { $(#removeThis).hideToggle();
This code is reading from mysql db tables and should return few names. But
This code throws parse error, which I do not understand why. function t(){ return
This code can be used to select the first ten records from a table
This code is supposed to read from an existing xml file, and write the
This code give me this error: c.apply is not a function All code works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.