about-widget.php
5 months ago
accordion-widget.php
1 month ago
accordion.php
5 months ago
attachment-url.php
5 months ago
audio.php
5 months ago
before-after.php
5 months ago
button.php
5 months ago
code.php
5 months ago
contact-box.php
5 months ago
contact-form.php
5 months ago
custom-list.php
5 months ago
divider.php
5 months ago
dropcap.php
5 months ago
facebook.php
5 months ago
flickr.php
5 months ago
gallery.php
5 months ago
gmap.php
5 months ago
highlight.php
5 months ago
image.php
5 months ago
instagram-feed.php
5 months ago
latest-posts-slider.php
5 months ago
popular-posts-widget.php
5 months ago
products-grid.php
5 months ago
quote.php
5 months ago
recent-posts-grid-carousel.php
5 months ago
recent-posts-land-style.php
5 months ago
recent-posts-masonry.php
5 months ago
recent-posts-tiles-carousel.php
5 months ago
recent-posts-tiles.php
5 months ago
recent-posts-timeline.php
5 months ago
recent-posts-widget.php
5 months ago
recent-products.php
5 months ago
related-posts.php
8 years ago
sample-element.php
5 months ago
search.php
5 months ago
socials-list.php
5 months ago
staff.php
5 months ago
tab-widget.php
5 months ago
tabs.php
5 months ago
testimonial.php
5 months ago
text.php
5 months ago
touch-slider.php
5 months ago
video.php
5 months ago
instagram-feed.php
392 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Instagram feed |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author averta |
| 9 | * @link http://phlox.pro/ |
| 10 | * @copyright (c) 2010-2026 averta |
| 11 | */ |
| 12 | function auxin_get_instagram_master_array( $master_array ) { |
| 13 | |
| 14 | $master_array['aux_instagram_feed'] = array( // shortcode info here |
| 15 | 'name' => __("instagram feed", 'auxin-elements' ), |
| 16 | 'auxin_output_callback' => 'auxin_widget_instagram_feed_callback', |
| 17 | 'base' => 'aux_instagram_feed', |
| 18 | 'description' => __('It adds an instagram feed element.', 'auxin-elements' ), |
| 19 | 'class' => 'aux-widget-instagram', |
| 20 | 'show_settings_on_create' => true, |
| 21 | 'weight' => 1, |
| 22 | 'is_widget' => true, |
| 23 | 'is_shortcode' => true, |
| 24 | 'category' => THEME_NAME, |
| 25 | 'group' => '', |
| 26 | 'admin_enqueue_js' => '', |
| 27 | 'admin_enqueue_css' => '', |
| 28 | 'front_enqueue_js' => '', |
| 29 | 'front_enqueue_css' => '', |
| 30 | 'icon' => 'aux-element aux-pb-icons-image', |
| 31 | 'custom_markup' => '', |
| 32 | 'js_view' => '', |
| 33 | 'html_template' => '', |
| 34 | 'deprecated' => '', |
| 35 | 'content_element' => '', |
| 36 | 'as_parent' => '', |
| 37 | 'as_child' => '', |
| 38 | 'params' => array( |
| 39 | array( |
| 40 | 'heading' => __('Title','auxin-elements' ), |
| 41 | 'description' => __('A title for instagram element', 'auxin-elements' ), |
| 42 | 'param_name' => 'title', |
| 43 | 'type' => 'textfield', |
| 44 | 'value' => '', |
| 45 | 'holder' => 'textfield', |
| 46 | 'class' => 'title', |
| 47 | 'admin_label' => true, |
| 48 | 'dependency' => '', |
| 49 | 'weight' => '', |
| 50 | 'group' => '' , |
| 51 | 'edit_field_class' => '' |
| 52 | ), |
| 53 | array( |
| 54 | 'heading' => __('Instagram user ID','auxin-elements' ), |
| 55 | 'description' => sprintf( |
| 56 | __('Instagram User ID. Separate multiple IDs by commas. You can find the User ID with %sthis tool%s.', 'auxin-elements' ), |
| 57 | '<a href="https://smashballoon.com/instagram-feed/find-instagram-user-id/" target="_blank">', |
| 58 | '</a>' |
| 59 | ), |
| 60 | 'param_name' => 'id', |
| 61 | 'type' => 'textfield', |
| 62 | 'value' => '', |
| 63 | 'def_value' => '', |
| 64 | 'holder' => 'textfield', |
| 65 | 'class' => 'user_id', |
| 66 | 'admin_label' => true, |
| 67 | 'dependency' => '', |
| 68 | 'weight' => '', |
| 69 | 'group' => '' , |
| 70 | 'edit_field_class' => '' |
| 71 | ), |
| 72 | array( |
| 73 | 'heading' => __('Number of photo','auxin-elements' ), |
| 74 | 'description' => __('Number of photos to display initially. Maximum is 33.','auxin-elements' ), |
| 75 | 'param_name' => 'num', |
| 76 | 'type' => 'textfield', |
| 77 | 'value' => '', |
| 78 | 'def_value' => '', |
| 79 | 'holder' => 'textfield', |
| 80 | 'class' => 'num', |
| 81 | 'admin_label' => true, |
| 82 | 'dependency' => '', |
| 83 | 'weight' => '', |
| 84 | 'group' => '' , |
| 85 | 'edit_field_class' => '' |
| 86 | ), |
| 87 | array( |
| 88 | 'heading' => __('Resolution/size of the photos. ','auxin-elements' ), |
| 89 | 'description' => '', |
| 90 | 'param_name' => 'imageres', |
| 91 | 'type' => 'dropdown', |
| 92 | 'def_value' => 'medium', |
| 93 | 'value' => array( |
| 94 | 'auto' => __('Auto', 'auxin-elements' ), |
| 95 | 'thumb' => __('Thumb', 'auxin-elements' ), |
| 96 | 'medium' => __('Medium', 'auxin-elements' ), |
| 97 | 'full' => __('Full', 'auxin-elements' ) |
| 98 | ), |
| 99 | 'holder' => '', |
| 100 | 'class' => 'border', |
| 101 | 'admin_label' => true, |
| 102 | 'dependency' => '', |
| 103 | 'weight' => '', |
| 104 | 'group' => '' , |
| 105 | 'edit_field_class' => '' |
| 106 | ), |
| 107 | array( |
| 108 | 'heading' => __('Columns','auxin-elements' ), |
| 109 | 'description' => __('Number of columns in the feed. 1 - 10.','auxin-elements' ), |
| 110 | 'param_name' => 'cols', |
| 111 | 'type' => 'textfield', |
| 112 | 'value' => '', |
| 113 | 'def_value' => '', |
| 114 | 'holder' => 'textfield', |
| 115 | 'class' => 'columns', |
| 116 | 'admin_label' => true, |
| 117 | 'dependency' => '', |
| 118 | 'weight' => '', |
| 119 | 'group' => '' , |
| 120 | 'edit_field_class' => '' |
| 121 | ), |
| 122 | array( |
| 123 | 'heading' => __('Spacing around the photos','auxin-elements' ), |
| 124 | 'description' => '', |
| 125 | 'param_name' => 'imagepadding', |
| 126 | 'type' => 'textfield', |
| 127 | 'value' => '0', |
| 128 | 'def_value' => '0', |
| 129 | 'holder' => 'textfield', |
| 130 | 'class' => 'height', |
| 131 | 'admin_label' => true, |
| 132 | 'dependency' => '', |
| 133 | 'weight' => '', |
| 134 | 'group' => '' , |
| 135 | 'edit_field_class' => '' |
| 136 | ), |
| 137 | array( |
| 138 | 'heading' => __('Unit of the spacing.','auxin-elements' ), |
| 139 | 'description' => '', |
| 140 | 'param_name' => 'imagepaddingunit', |
| 141 | 'type' => 'dropdown', |
| 142 | 'def_value' => 'px', |
| 143 | 'value' => array( |
| 144 | '%' => __('Percentage (%)', 'auxin-elements' ), |
| 145 | 'px' => __('Pixels (px)', 'auxin-elements' ), |
| 146 | ), |
| 147 | 'holder' => '', |
| 148 | 'class' => 'border', |
| 149 | 'admin_label' => true, |
| 150 | 'dependency' => '', |
| 151 | 'weight' => '', |
| 152 | 'group' => '' , |
| 153 | 'edit_field_class' => '' |
| 154 | ), |
| 155 | // array( |
| 156 | // 'param_name' => 'width', |
| 157 | // 'type' => 'textfield', |
| 158 | // 'value' => '100', |
| 159 | // 'def_value' => '100', |
| 160 | // 'holder' => 'textfield', |
| 161 | // 'class' => 'width', |
| 162 | // 'heading' => __('width','auxin-elements' ), |
| 163 | // 'description' => '', |
| 164 | // 'admin_label' => true, |
| 165 | // 'dependency' => '', |
| 166 | // 'weight' => '', |
| 167 | // 'group' => '' , |
| 168 | // 'edit_field_class' => '' |
| 169 | // ), |
| 170 | // array( |
| 171 | // 'param_name' => 'widthunit', |
| 172 | // 'type' => 'dropdown', |
| 173 | // 'def_value' => '%', |
| 174 | // 'value' => array( |
| 175 | // '%' => __('Percentage (%)', 'auxin-elements' ), |
| 176 | // 'px' => __('Pixels (px)', 'auxin-elements' ), |
| 177 | // ), |
| 178 | // 'holder' => '', |
| 179 | // 'class' => 'border', |
| 180 | // 'heading' => __(' The unit of the width.','auxin-elements' ), |
| 181 | // 'description' => '', |
| 182 | // 'admin_label' => true, |
| 183 | // 'dependency' => '', |
| 184 | // 'weight' => '', |
| 185 | // 'group' => '' , |
| 186 | // 'edit_field_class' => '' |
| 187 | // ), |
| 188 | array( |
| 189 | 'heading' => __('Height','auxin-elements' ), |
| 190 | 'description' => __('The height of the feed','auxin-elements' ), |
| 191 | 'param_name' => 'height', |
| 192 | 'type' => 'textfield', |
| 193 | 'value' => '', |
| 194 | 'def_value' => '', |
| 195 | 'holder' => 'textfield', |
| 196 | 'class' => 'height', |
| 197 | 'admin_label' => true, |
| 198 | 'dependency' => '', |
| 199 | 'weight' => '', |
| 200 | 'group' => '' , |
| 201 | 'edit_field_class' => '' |
| 202 | ), |
| 203 | array( |
| 204 | 'heading' => __('Unit of the height.','auxin-elements' ), |
| 205 | 'description' => '', |
| 206 | 'param_name' => 'heightunit', |
| 207 | 'type' => 'dropdown', |
| 208 | 'def_value' => 'px', |
| 209 | 'value' => array( |
| 210 | '%' => __('Percentage (%)', 'auxin-elements' ), |
| 211 | 'px' => __('Pixels (px)', 'auxin-elements' ), |
| 212 | ), |
| 213 | 'holder' => '', |
| 214 | 'class' => 'border', |
| 215 | 'admin_label' => true, |
| 216 | 'dependency' => '', |
| 217 | 'weight' => '', |
| 218 | 'group' => '' , |
| 219 | 'edit_field_class' => '' |
| 220 | ), |
| 221 | array( |
| 222 | 'heading' => __('Background color','auxin-elements' ), |
| 223 | 'description' => '', |
| 224 | 'param_name' => 'background', |
| 225 | 'type' => 'color', |
| 226 | 'value' => '', |
| 227 | 'def_value' => '', |
| 228 | 'holder' => 'textfield', |
| 229 | 'class' => 'background-color', |
| 230 | 'admin_label' => true, |
| 231 | 'dependency' => '', |
| 232 | 'weight' => '', |
| 233 | 'group' => '' , |
| 234 | 'edit_field_class' => '' |
| 235 | ), |
| 236 | array( |
| 237 | 'heading' => __('Show header','auxin-elements' ), |
| 238 | 'description' => __('Whether to show the feed header.', 'auxin-elements' ), |
| 239 | 'param_name' => 'showheader', |
| 240 | 'type' => 'aux_switch', |
| 241 | 'def_value' => '', |
| 242 | 'value' => '0', |
| 243 | 'holder' => '', |
| 244 | 'class' => 'showheader', |
| 245 | 'admin_label' => true, |
| 246 | 'dependency' => '', |
| 247 | 'weight' => '', |
| 248 | 'group' => '' , |
| 249 | 'edit_field_class' => '' |
| 250 | ), |
| 251 | array( |
| 252 | 'heading' => __('Show follow button','auxin-elements' ), |
| 253 | 'description' => __('Whether to show the Follow on Instagram button.', 'auxin-elements' ), |
| 254 | 'param_name' => 'showfollow', |
| 255 | 'type' => 'aux_switch', |
| 256 | 'def_value' => '', |
| 257 | 'value' => '0', |
| 258 | 'holder' => '', |
| 259 | 'class' => 'showfollow', |
| 260 | 'admin_label' => true, |
| 261 | 'dependency' => '', |
| 262 | 'weight' => '', |
| 263 | 'group' => '' , |
| 264 | 'edit_field_class' => '' |
| 265 | ), |
| 266 | array( |
| 267 | 'heading' => __('Show load more button','auxin-elements' ), |
| 268 | 'description' => __(' Whether to show the load more button.', 'auxin-elements' ), |
| 269 | 'param_name' => 'showbutton', |
| 270 | 'type' => 'aux_switch', |
| 271 | 'def_value' => '', |
| 272 | 'value' => '0', |
| 273 | 'holder' => '', |
| 274 | 'class' => 'showbutton', |
| 275 | 'admin_label' => true, |
| 276 | 'dependency' => '', |
| 277 | 'weight' => '', |
| 278 | 'group' => '' , |
| 279 | 'edit_field_class' => '' |
| 280 | ), |
| 281 | array( |
| 282 | 'heading' => __('Extra class name','auxin-elements' ), |
| 283 | 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements' ), |
| 284 | 'param_name' => 'extra_classes', |
| 285 | 'type' => 'textfield', |
| 286 | 'value' => '', |
| 287 | 'def_value' => '', |
| 288 | 'holder' => 'textfield', |
| 289 | 'class' => 'extra_classes', |
| 290 | 'admin_label' => true, |
| 291 | 'dependency' => '', |
| 292 | 'weight' => '', |
| 293 | 'group' => '' , |
| 294 | 'edit_field_class' => '' |
| 295 | ) |
| 296 | ) |
| 297 | ); |
| 298 | |
| 299 | return $master_array; |
| 300 | } |
| 301 | |
| 302 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_instagram_master_array', 10, 1 ); |
| 303 | |
| 304 | // This is the widget call back in fact the front end out put of this widget comes from this function |
| 305 | function auxin_widget_instagram_feed_callback( $atts, $shortcode_content = null ) { |
| 306 | |
| 307 | $default_atts = array( |
| 308 | 'title' => '', |
| 309 | 'id' => '', |
| 310 | 'width' => '100', |
| 311 | 'widthunit' => '%', |
| 312 | 'height' => '', |
| 313 | 'heightunit' => 'px', |
| 314 | 'background' => '', |
| 315 | 'imagepadding' => '0', |
| 316 | 'imagepaddingunit' => 'px', |
| 317 | 'cols' => '', |
| 318 | 'num' => '', |
| 319 | 'showheader' => '0', |
| 320 | 'imageres' => 'medium', |
| 321 | 'showfollow' => '0', |
| 322 | 'showbutton' => '0', |
| 323 | |
| 324 | 'extra_classes' => '', // custom css class names for this element |
| 325 | 'custom_el_id' => '', // custom id attribute for this element |
| 326 | 'base_class' => 'aux-widget-instagram' // base class name for container |
| 327 | ); |
| 328 | |
| 329 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 330 | extract( $result['parsed_atts'] ); |
| 331 | |
| 332 | ob_start(); |
| 333 | |
| 334 | // widget header ------------------------------ |
| 335 | echo wp_kses_post( $result['widget_header'] ); |
| 336 | echo wp_kses_post( $result['widget_title'] ); |
| 337 | |
| 338 | |
| 339 | // widget custom output ----------------------- |
| 340 | if( ! empty( $id ) ) { |
| 341 | $id =" id=$id"; |
| 342 | } |
| 343 | |
| 344 | // if( ! empty( $width ) ) { |
| 345 | // $width =" width=$width"; |
| 346 | // } |
| 347 | |
| 348 | if( ! empty( $height ) ) { |
| 349 | $height =" height=$height"; |
| 350 | } |
| 351 | |
| 352 | if( ! empty( $background ) ) { |
| 353 | $background =" background=\"$background\""; |
| 354 | } |
| 355 | |
| 356 | if( ! empty( $cols ) ) { |
| 357 | $cols =" cols=$cols"; |
| 358 | } |
| 359 | |
| 360 | if( ! empty( $num ) ) { |
| 361 | $num =" num=$num"; |
| 362 | } |
| 363 | |
| 364 | if( ! empty( $extra_classes ) ) { |
| 365 | $extra_classes =" class=\"$extra_classes\""; |
| 366 | } |
| 367 | |
| 368 | $instagram_feed_shortcode = "[instagram-feed width=100 widthunit=\"%\"". |
| 369 | $id. |
| 370 | " showbutton=$showbutton". |
| 371 | " showfollow=$showfollow". |
| 372 | " showheader=$showheader". |
| 373 | " imageres=\"$imageres\"". |
| 374 | // $width. |
| 375 | //" widthunit=\"$widthunit\"". |
| 376 | $height. |
| 377 | " heightunit=\"$heightunit\"". |
| 378 | " imagepaddingunit=\"$imagepaddingunit\"". |
| 379 | " imagepadding=$imagepadding". |
| 380 | $background. |
| 381 | $cols. |
| 382 | $num. |
| 383 | $extra_classes. |
| 384 | "]"; |
| 385 | |
| 386 | echo do_shortcode( $instagram_feed_shortcode ); |
| 387 | // widget footer ------------------------------ |
| 388 | echo wp_kses_post( $result['widget_footer'] ); |
| 389 | |
| 390 | return ob_get_clean(); |
| 391 | } |
| 392 |