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
attachment-url.php
53 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Retrieves attachment URL |
| 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 | |
| 13 | add_shortcode( 'aux_attach_url', 'auxin_shortcode_attach_id' ); |
| 14 | |
| 15 | function auxin_shortcode_attach_id( $atts, $content = null ) { |
| 16 | extract( shortcode_atts( array( 'id' => '' ) , $atts ) ); |
| 17 | if( empty( $id ) ){ |
| 18 | return ''; |
| 19 | } |
| 20 | return wp_get_attachment_url( $id ); |
| 21 | } |
| 22 | |
| 23 | |
| 24 | add_shortcode( 'aux_responsive_image_tag', 'auxin_shortcode_responsive_image_tag' ); |
| 25 | |
| 26 | function auxin_shortcode_responsive_image_tag( $atts, $content = null ) { |
| 27 | |
| 28 | $attrs = shortcode_atts( |
| 29 | array( |
| 30 | 'id' => '', |
| 31 | 'quality' => 100, |
| 32 | 'preloadable' => true, // Set it to "true" or "null" in order make the image ready for preloading, "true" will load the best match as well. |
| 33 | 'preload_preview' => true, // (true, false, 'progress') if true, insert a low quality placeholder until lazyloading the main image. If set to progress, display a progress animation as a placeholder. |
| 34 | 'upscale' => false, |
| 35 | 'size' => 'large', |
| 36 | 'crop' => null, |
| 37 | 'add_hw' => true, |
| 38 | 'add_ratio' => true, |
| 39 | 'sizes' => 'auto', // (sizes) |
| 40 | 'srcset' => 'auto', // (srcset) automatically calculate the image sizes based on the 'size' param, OR 'wp' generates image srcs based on WP default image sizes |
| 41 | 'original_src' => true, |
| 42 | 'extra_class' => '' |
| 43 | ), |
| 44 | $atts ); |
| 45 | |
| 46 | |
| 47 | if( empty( $attrs['id'] ) ){ |
| 48 | return ''; |
| 49 | } |
| 50 | |
| 51 | return auxin_get_the_responsive_attachment( $attrs['id'], $attrs ); |
| 52 | } |
| 53 |