kerigansolutions / instagram-autogallery-wp
1.2
2023-03-23 13:46 UTC
Requires
- guzzlehttp/guzzle: ^7
- illuminate/support: ^8
- vlucas/phpdotenv: ^5.4
README
Easily pull posts into your WordPress Site from an Instagram page lnked to a Facebook Business page that you manage. WordPress is required and a special Admin page in WordPress is created. Posts are fetched and added to the WP database using a cron that runs every hour.
Status
Currently the app is configured to work with Posts.
Installation
composer require kerigansolutions/fb-instagram-wp
Setup
- Make sure you have admin access to the FB page and it is linked to the Instagram page you need to sync.
- Log into WordPress and go to the new Instagram Settings menu item.
- Authorize the app using app secret (FYI only KMA knows this).
- Use the Auth tool to authorize the app to use a Facebook page you manage and select the Instagram feed.
- Use the sync tool to build the database of posts.
- Program a view to show the data in your templates.
Include or Extend the WP Admin class:
use KeriganSolutions\Instagram; use KeriganSolutions\Instagram\WP\InstagramPost; class Instagram extends Instagram\WP\Admin { // retrieve posts from WP database public function getInstagramPosts($num = -1, $args = []) { return (new InstagramPost())->query($num, $args); } }
Or make the API call and retrieve the results directly:
use KeriganSolutions\Instagram\WP\InstagramPost; $feed = new InstagramPost; $results = $feed->query(5);
fetch("/wp-json/kerigansolutions/v1/get-kma-instagram-post", { method: 'GET', mode: 'cors', cache: 'no-cache', headers: { 'Content-Type': 'application/json', }, }) .then(r => r.json()) .then((res) => { // do something with res })