get_settings_for_display(); $this->add_inline_editing_attributes( 'title', 'none' ); $this->add_render_attribute( 'title', 'class', 'text-white fz-18 font-weight-normal text-uppercase mb-0 pt-2 ad-instagram-name' ); $this->add_render_attribute( 'advanced_instragram', 'class', 'advanced-instragram' ); $this->add_render_attribute( 'advanced_instragram', 'class', 'advanced-instragram-style-'.$settings['instagram_style'] ); $imagesize = $settings['instagram_image_size']; $limit = !empty( $settings['limit'] ) ? $settings['limit'] : 8; $id = !empty( $check_component_active['instagram_user_id'] ) ? $check_component_active['instagram_user_id'] : 6666969077; $token = !empty( $check_component_active['instagram_access_token'] ) ? $check_component_active['instagram_access_token'] : '6666969077.1677ed0.d325f406d94c4dfab939137c5c2cc6c2'; $response = wp_remote_get( 'https://api.instagram.com/v1/users/' . esc_attr( $id ) . '/media/recent/?access_token=' . esc_attr( $token ) . '&count=' . esc_attr( $limit ) ); if ( ! is_wp_error( $response ) ) { $response_body = json_decode( $response['body'] ); if ( empty( $response_body ) ) { echo '
'.esc_html__('Incorrect user ID specified.','aa_elementor').'
'; return; } $username = $profile_link = ''; if(isset($response_body->data)){ $items_as_objects = $response_body->data; $items = array(); foreach ( $items_as_objects as $item_object ) { $item['link'] = $item_object->link; $item['imgsrc'] = $item_object->images->low_resolution->url; $item['imgfullsrc'] = $item_object->images->$imagesize->url; $item['comments'] = $item_object->comments->count; $item['likes'] = $item_object->likes->count; $username = $item_object->user->username; $profile_link = 'https://www.instagram.com/'.$username; $items[] = $item; } } } $short_user = substr($username,10); ?>