Instagram Feed - Version 1.2.1

Version Description

  • Fix: Fixed a minor issue with the Custom JavaScript being run before the photos are loaded
  • Fix: Removed stray PHP notices
  • Fix: Changed the double quotes to single quotes on the 'data-options' attribute
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Instagram Feed
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2 to 1.2.1

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon
3
Tags: Instagram, Instagram feed, Instagram photos, Instagram plugin, Instagram stream, Custom Instagram Feed, responsive Instagram, mobile Instagram, Instagram posts, Instagram wall, Instagram account
4
Requires at least: 3.0
5
Tested up to: 4.0
6
- Stable tag: 1.2
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -127,6 +127,11 @@ For more shortcode options, check out the [Pro version](https://smashballoon.com
127
128
== Changelog ==
129
130
= 1.2 =
131
* New: Added Custom CSS and Custom JavaScript sections which allow you to add your own custom CSS and JavaScript to the plugin
132
* New: Added an option to display your Instagram photos in random order
3
Tags: Instagram, Instagram feed, Instagram photos, Instagram plugin, Instagram stream, Custom Instagram Feed, responsive Instagram, mobile Instagram, Instagram posts, Instagram wall, Instagram account
4
Requires at least: 3.0
5
Tested up to: 4.0
6
+ Stable tag: 1.2.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
127
128
== Changelog ==
129
130
+ = 1.2.1 =
131
+ * Fix: Fixed a minor issue with the Custom JavaScript being run before the photos are loaded
132
+ * Fix: Removed stray PHP notices
133
+ * Fix: Changed the double quotes to single quotes on the 'data-options' attribute
134
+
135
= 1.2 =
136
* New: Added Custom CSS and Custom JavaScript sections which allow you to add your own custom CSS and JavaScript to the plugin
137
* New: Added an option to display your Instagram photos in random order
instagram-feed-admin.php CHANGED
@@ -188,7 +188,7 @@ function sb_instagram_settings_page() {
188
<span class="sbi_pro">
189
<input disabled type="radio" name="sb_instagram_type" id="sb_instagram_type_hashtag" value="hashtag" <?php if($sb_instagram_type == "hashtag") echo "checked"; ?> />
190
<label class="sbi_radio_label" for="sb_instagram_type_hashtag">Hashtag:</label>
191
- <input readonly name="sb_instagram_hashtag" id="sb_instagram_hashtag" type="text" value="<?php esc_attr_e( $sb_instagram_hashtag ); ?>" size="25" />
192
&nbsp;<a class="sbi_tooltip_link sbi_pro" href="JavaScript:void(0);"><?php _e("What is this?"); ?></a><span class="sbi_note"><a href="https://smashballoon.com/instagram-feed/" target="_blank">- Upgrade to Pro to show posts by Hashtag</a></span>
193
<p class="sbi_tooltip"><?php _e("Display posts from a specific hashtag instead of from a user"); ?></p>
194
</span>
188
<span class="sbi_pro">
189
<input disabled type="radio" name="sb_instagram_type" id="sb_instagram_type_hashtag" value="hashtag" <?php if($sb_instagram_type == "hashtag") echo "checked"; ?> />
190
<label class="sbi_radio_label" for="sb_instagram_type_hashtag">Hashtag:</label>
191
+ <input readonly type="text" size="25" />
192
&nbsp;<a class="sbi_tooltip_link sbi_pro" href="JavaScript:void(0);"><?php _e("What is this?"); ?></a><span class="sbi_note"><a href="https://smashballoon.com/instagram-feed/" target="_blank">- Upgrade to Pro to show posts by Hashtag</a></span>
193
<p class="sbi_tooltip"><?php _e("Display posts from a specific hashtag instead of from a user"); ?></p>
194
</span>
instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Instagram Feed
4
Plugin URI: http://smashballoon.com/instagram-feed
5
Description: Add a simple customizable Instagram feed to your website
6
- Version: 1.2
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
@@ -97,12 +97,12 @@ function display_instagram($atts, $content = null) {
97
$sb_instagram_content = '<div id="sb_instagram" class="sbi ';
98
if ( !empty($sb_instagram_height) ) $sb_instagram_content .= 'sbi_fixed_height ';
99
$sb_instagram_content .= 'sbi_col_' . trim($sb_instagram_cols);
100
- $sb_instagram_content .= '" '.$sb_instagram_styles .' data-id="' . $sb_instagram_user_id . '" data-num="' . trim($atts['num']) . '" data-res="' . trim($atts['imageres']) . '" data-options="{&quot;sortby&quot;: &quot;'.$atts['sortby'].'&quot;}">';
101
102
$sb_instagram_content .= '<div id="sbi_images" style="padding: '.$sb_instagram_image_padding . $sb_instagram_image_padding_unit .';">';
103
104
//Error messages
105
- if( $sb_instagram_type == 'user' && ( empty($sb_instagram_user_id) || !isset($sb_instagram_user_id) ) ) $sb_instagram_content .= '<p>Please enter a User ID on the Instagram plugin Settings page</p>';
106
107
if( empty($options[ 'sb_instagram_at' ]) || !isset($options[ 'sb_instagram_at' ]) ) $sb_instagram_content .= '<p>Please enter an Access Token on the Instagram Feed plugin Settings page</p>';
108
@@ -134,7 +134,7 @@ function sb_instagram_styles_enqueue() {
134
add_action( 'wp_enqueue_scripts', 'sb_instagram_scripts_enqueue' );
135
function sb_instagram_scripts_enqueue() {
136
//Register the script to make it available
137
- wp_register_script( 'sb_instagram_scripts', plugins_url( '/js/sb-instagram.js?3' , __FILE__ ), array('jquery'), '1.8', true );
138
139
//Options to pass to JS file
140
$sb_instagram_settings = get_option('sb_instagram_settings');
@@ -177,8 +177,12 @@ function sb_instagram_custom_js() {
177
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
178
if( !empty($sb_instagram_custom_js) ) echo "jQuery( document ).ready(function($) {";
179
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
180
if( !empty($sb_instagram_custom_js) ) echo stripslashes($sb_instagram_custom_js);
181
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
182
if( !empty($sb_instagram_custom_js) ) echo "});";
183
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
184
if( !empty($sb_instagram_custom_js) ) echo '</script>';
3
Plugin Name: Instagram Feed
4
Plugin URI: http://smashballoon.com/instagram-feed
5
Description: Add a simple customizable Instagram feed to your website
6
+ Version: 1.2.1
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
97
$sb_instagram_content = '<div id="sb_instagram" class="sbi ';
98
if ( !empty($sb_instagram_height) ) $sb_instagram_content .= 'sbi_fixed_height ';
99
$sb_instagram_content .= 'sbi_col_' . trim($sb_instagram_cols);
100
+ $sb_instagram_content .= '" '.$sb_instagram_styles .' data-id="' . $sb_instagram_user_id . '" data-num="' . trim($atts['num']) . '" data-res="' . trim($atts['imageres']) . '" data-options=\'{&quot;sortby&quot;: &quot;'.$atts['sortby'].'&quot;}\'>';
101
102
$sb_instagram_content .= '<div id="sbi_images" style="padding: '.$sb_instagram_image_padding . $sb_instagram_image_padding_unit .';">';
103
104
//Error messages
105
+ if( empty($sb_instagram_user_id) || !isset($sb_instagram_user_id) ) $sb_instagram_content .= '<p>Please enter a User ID on the Instagram plugin Settings page</p>';
106
107
if( empty($options[ 'sb_instagram_at' ]) || !isset($options[ 'sb_instagram_at' ]) ) $sb_instagram_content .= '<p>Please enter an Access Token on the Instagram Feed plugin Settings page</p>';
108
134
add_action( 'wp_enqueue_scripts', 'sb_instagram_scripts_enqueue' );
135
function sb_instagram_scripts_enqueue() {
136
//Register the script to make it available
137
+ wp_register_script( 'sb_instagram_scripts', plugins_url( '/js/sb-instagram.js?4' , __FILE__ ), array('jquery'), '1.8', true );
138
139
//Options to pass to JS file
140
$sb_instagram_settings = get_option('sb_instagram_settings');
177
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
178
if( !empty($sb_instagram_custom_js) ) echo "jQuery( document ).ready(function($) {";
179
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
180
+ if( !empty($sb_instagram_custom_js) ) echo "window.sbi_custom_js = function(){";
181
+ if( !empty($sb_instagram_custom_js) ) echo "\r\n";
182
if( !empty($sb_instagram_custom_js) ) echo stripslashes($sb_instagram_custom_js);
183
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
184
+ if( !empty($sb_instagram_custom_js) ) echo "}";
185
+ if( !empty($sb_instagram_custom_js) ) echo "\r\n";
186
if( !empty($sb_instagram_custom_js) ) echo "});";
187
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
188
if( !empty($sb_instagram_custom_js) ) echo '</script>';
js/sb-instagram.js CHANGED
@@ -50,7 +50,19 @@
50
$loadBtn.hide();
51
$self.css('padding-bottom', 0);
52
}
53
- }
54
});
55
56
$loadBtn.find('a').on("click", function() {
50
$loadBtn.hide();
51
$self.css('padding-bottom', 0);
52
}
53
+ },
54
+ success: function(){
55
+
56
+ //Run 10ms after the feed is returned
57
+ var sbiFeedLoaded = setInterval(function () {
58
+
59
+ //Run custom JS
60
+ if (typeof sbi_custom_js == 'function') sbi_custom_js();
61
+
62
+ clearInterval(sbiFeedLoaded);
63
+ }, 10);
64
+
65
+ }
66
});
67
68
$loadBtn.find('a').on("click", function() {