Code Monkey home page Code Monkey logo

jerewall / instagram-feed-using-advanced-custom-fields Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 66 KB

This lets you easily add an Intagram feed to any site without using plugins or code configuration. Its created using Advanced Custom Fields (ACF) and the main settings are done through the main panel using its own Instagram Feed tab.

License: GNU General Public License v3.0

CSS 92.81% PHP 7.19%
wordpress instagram jquery acf advancedcustomfields instafeed

instagram-feed-using-advanced-custom-fields's Introduction

Instagram Feed using Advanced Custom Fields

This lets you easily add an Intagram feed to any site without using plugins or code configuration. Its created using Advanced Custom Fields (ACF) and the main settings are done through the main panel using its own Instagram Feed tab. This script is based on Instafeed.js (https://github.com/stevenschobert/instafeed.js) by stevenschobert. You will need a User ID and Access Token. Instructions to get these can be found within the Instagram ACF panel.

The feed can load up to 60 images at a time, and will automatically load more images when you scroll to the bottom of the page. If you wish to disable this feature, simply remove the following code from global.js

 $(window).scroll(function () {
         if ($(window).scrollTop() + $(window).height() == $(document).height()) {
             // call feed.next() once the page reaches the bottom
             instaFeed.next();
         }
     });

The images automatically link to a larger version of themselves using shadowbox with the original caption from Instagram. By default, this template will automatically pull the number of likes, users profie picture, and users images in most-recent order.

This script is responsive so it is desktop, tablet, and mobile friendly out of the box. If you need to tweak image sizes based on breakpoints, you can do so within the _instafeed.scss file.

The Backend Preview:

The Front-End Preview

Full Demo

A full demo of this script (tested) can be found here: http://jerewall.myregisteredwp.com/

The Javascript

The javascript can be found within the global.js file. Add this to your websites global javascript/jQuery file or create your own. If you cannot create your own, you can add this to your websites head tag with a script tag using document ready but is not reccomended as the file is quite large.

The CSS

The scss file can be added to your site by moving the '_instafeed.scss' file to your /scss/ folder and importing it within your style.scss document. EX: @import 'scss/instafeed';

The HTML

The only 2 thing's you need to add to your HTML is this div: <div id="instafeed"></div> wherever you want the feed to display, and at the top of the page, right before the </head> tag paste :

       <script type="text/javascript">
       var token = '<?php echo get_field('access_token', 'option'); ?>'
       var user_id = '<?php echo get_field('user_id', 'option'); ?>'
       var limit = '<?php echo get_field('limit', 'option'); ?>'
       var sort_by = '<?php echo get_field('sort_by', 'option'); ?>'
    </script>

The Functions

You need to add the following code to your functions (functions.php) file: if ( is_admin() ) include_once get_template_directory() . '/instagram-options.php';

Instagram Theme Option Panel

Just drop this file in the root of your wordpress theme. File Name: instagram-options.php

The ACF Import File

Just upload the included JSON file using ACF. File name: instagram-acf-import.json

The Images

Any images that are required can be found within the images folder, just move these to your images folder. They are used by shadowbox.

instagram-feed-using-advanced-custom-fields's People

Contributors

jerewall avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

bolohori

instagram-feed-using-advanced-custom-fields's Issues

Mixins not defined, Shadowbox not defined

I feel like both of these are probably quick solutions but rather than write my own I figured Id ask you first:

  1. the "bp" mixin and variables arent defined, what are you using for those? (again I know I could define the mixin and use my own values for the variables)

  2. line 1 of global.js "Shadowbox" is not defined... is there a JS library that I need in order for shadowbox to work? (I googled but there were a few and I want to make sure I grab the right one)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.