diff --git a/readme.txt b/readme.txt
index 3f31cfc..39b1e95 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Donate link: https://switchwebdev.com/wordpress-plugins/
Tags: Instagram, Instagram photos, Instagram feed, Instagram widget, Instagram gallery
Requires at least: 3.4
Tested up to: 5.5
-Stable tag: 2.4.5
+Stable tag: 2.5.0
Requires PHP: 5.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
diff --git a/sim-social.php b/sim-social.php
index b40bd11..c3f350b 100644
--- a/sim-social.php
+++ b/sim-social.php
@@ -12,7 +12,7 @@
* Plugin Name: Sim Social Feed
* Plugin URI: https://switchwebdev.com/wordpress-plugins/
* Description: Easily Display Social Media Photo Feed for Instagram. The feed will schedule twicedaily updates, you can also update manually with a single click.
- * Version: 2.4.5
+ * Version: 2.5.0
* Requires at least: 3.4
* Requires PHP: 5.6
* Author: SwitchWebdev.com
diff --git a/src/InstagramSocialFeed.php b/src/InstagramSocialFeed.php
index dce3f05..e0e9bfd 100644
--- a/src/InstagramSocialFeed.php
+++ b/src/InstagramSocialFeed.php
@@ -137,12 +137,18 @@ public static function token_expire_date() {
/**
* List images
*
+ * @param string $limit .
* @param string $w .
* @param string $css .
*/
- public static function images( $w = '250', $css = '' ) {
+ public static function images( $limit = 6, $w = '250', $css = '' ) {
echo '
'; // @codingStandardsIgnoreLine
if ( is_array( get_option( 'simsf_user_media' ) ) ) {
+ /**
+ * Get IG list
+ * limit the return values
+ */
+ $i = 0;
foreach ( get_option( 'simsf_user_media' ) as $mkey => $media ) {
if ( isset( $media->caption ) ) {
$caption = $media->caption;
@@ -150,7 +156,8 @@ public static function images( $w = '250', $css = '' ) {
$caption = '';
}
if ( 'VIDEO' === $media->media_type ) continue;
- echo '
';
+ echo '
';
+ if ( ++$i === $limit ) break;
}
}
echo '
';
@@ -192,4 +199,43 @@ public static function igfeed( $limit = 6 ) {
'; // @codingStandardsIgnoreLine
+ if ( is_array( get_option( 'simsf_user_media' ) ) ) {
+ /**
+ * Get IG list
+ * limit the return values
+ */
+ $i = 0;
+ foreach ( get_option( 'simsf_user_media' ) as $mkey => $media ) {
+ if ( isset( $media->caption ) ) {
+ $caption = $media->caption;
+ } else {
+ $caption = '';
+ }
+ if ( 'VIDEO' === $media->media_type ) continue;
+ $output = '';
+ echo $output; // @codingStandardsIgnoreLine
+ if ( ++$i === $limit ) break;
+ }
+ }
+ echo '';
+ }
}
diff --git a/src/schedule.php b/src/schedule.php
index 818021b..d783c3f 100644
--- a/src/schedule.php
+++ b/src/schedule.php
@@ -3,15 +3,15 @@
use SimSocialFeed\InstagramSocialFeed;
/**
- * run the sim social feed update
+ * Run the sim social feed update
*/
- add_action( 'sim_social_feed_cron', 'sim_social_igfeed_update' );
- function sim_social_igfeed_update(){
+ function sim_social_igfeed_update() {
/**
- * update user media
+ * Update user media
*/
if ( InstagramSocialFeed::is_request_ok() ) :
$ig_user_media = InstagramSocialFeed::user_media();
- update_option('simsf_user_media', $ig_user_media->data );
+ update_option( 'simsf_user_media', $ig_user_media->data );
endif;
}
+ add_action( 'sim_social_feed_cron', 'sim_social_igfeed_update' );
diff --git a/src/shortcode.php b/src/shortcode.php
index 1d37608..44ea31f 100644
--- a/src/shortcode.php
+++ b/src/shortcode.php
@@ -3,26 +3,43 @@
use SimSocialFeed\InstagramSocialFeed;
/**
- * shortcode to use [ig_socialfeed limit="6"]
+ * Shortcode to use [ig_socialfeed limit="6" linked="yes"]
+ *
+ * @param array $atts .
+ *
+ * @return string $output_sfd
*/
- add_shortcode('ig_socialfeed', 'simsf_igmedia_feed');
- function simsf_igmedia_feed($atts) {
+ function simsf_igmedia_feed( $atts ) {
- $a = shortcode_atts(array(
- 'limit' => 6,
- ), $atts);
+ $a = shortcode_atts(
+ array(
+ 'limit' => 6,
+ 'linked' => 'no',
+ ),
+ $atts
+ );
- // params
- $limit = $a['limit'];
+ // params .
+ $limit = absint( $a['limit'] );
+ $linked = strtolower( $a['linked'] );
/**
- * load the grid styles
+ * Load the grid styles
*/
- wp_enqueue_style('sim-social-feed-grid');
+ wp_enqueue_style( 'sim-social-feed-grid' );
ob_start();
- InstagramSocialFeed::igfeed($limit);
+
+ if ( 'yes' === $linked ) {
+ InstagramSocialFeed::igfeedlinked( $limit );
+ } else {
+ InstagramSocialFeed::igfeed( $limit );
+ }
+
$output_sfd = ob_get_contents();
+
ob_end_clean();
+
return $output_sfd;
}
+ add_shortcode( 'ig_socialfeed', 'simsf_igmedia_feed' );