1. Go to this page and download the library: Download eleven-miles/instagram library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eleven-miles / instagram example snippets
// Add in your SiteSettings class (or similar)
use ElevenMiles\Instagram\Admin\InstagramSettings;
// Configure the instagram field reference
$prefix = 'site_settings';
$settings_fields = [
$this->addTab($prefix, 'Social links'),
$this->url($prefix, 'Instagram URL'),
];
acf_add_local_field_group([
'key' => 'group_site_settings',
'title' => 'Site Settings',
'fields' => $settings_fields,
// etc
]);
// Add in your SiteSettings class (or similar) admin page constructor
add_action('acf/render_field/name=instagram_url', [InstagramSettings::class, 'instagramAuthLink']);
// Add in your theme Kernel class
use ElevenMiles\Instagram\Admin\InstagramSettings;
new InstagramSettings();
use ElevenMiles\Instagram\InstagramFeed;
$instagram = new InstagramFeed();
$instagram_data = $instagram->getData();
// Pass the data to your timber context, ready to use in your twig templates
$context['instagram'] = $instagram_data;