array( $this, 'aesop_post_gallery' )
) );
}
}
/**
* Main gallery component
*
* @since 1.0.0
*/
public function aesop_post_gallery( $atts ) {
global $post;
// attributes
$defaults = array( 'id' => '', 'revealfx' => 'off' );
$atts = shortcode_atts( $defaults, $atts );
// gallery ID
$gallery_id = isset( $atts['id'] ) ? (int) $atts['id'] : false;
// alias to new atts type
// let this be used multiple times
static $instance = 0;
$instance++;
$unique = sprintf( '%s-%s', $gallery_id, $instance );
// get gallery images and custom attrs
$image_ids = get_post_meta( $gallery_id, '_ase_gallery_images', true );
$image_ids = array_map( 'intval', explode( ',', $image_ids ) );
$type = get_post_meta( $gallery_id, 'aesop_gallery_type', true );
$width = get_post_meta( $gallery_id, 'aesop_gallery_width', true );
// gallery caption
$gallery_caption = get_post_meta( $gallery_id, 'aesop_gallery_caption', true );
// custom classes
$classes = aesop_component_classes( 'gallery', '' );
ob_start();
do_action( 'aesop_gallery_before', $type, $gallery_id, $atts, $unique ); // action
$hidden ="";
if (aesop_revealfx_set($atts) && $type != 'stacked') {
$hidden ='style="visibility:hidden;"';
}
?>
class="aesop-component aesop-gallery-component aesop--gallery-wrap " >aesop_thumb_gallery( $gallery_id, $image_ids, $width );
break;
case 'grid':
$this->aesop_grid_gallery( $gallery_id, $image_ids, $width,$unique );
break;
case 'stacked':
$this->aesop_stacked_gallery( $gallery_id, $image_ids, $unique );
break;
case 'sequence':
$this->aesop_sequence_gallery( $gallery_id, $image_ids, $unique);
break;
case 'photoset':
$this->aesop_photoset_gallery( $gallery_id, $image_ids, $width, $unique);
break;
case 'hero':
$this->aesop_hero_gallery( $gallery_id, $image_ids, $width );
break;
default:
$this->aesop_grid_gallery( $gallery_id, $image_ids, $width, $unique);
break;
}
if ( $gallery_caption ) {
printf( '
%s
', esc_html( $gallery_caption ) );
}
// provide the edit link to the backend edit if Aesop Editor is not active
if ( ! function_exists( 'lasso_editor_components' ) && is_user_logged_in() && current_user_can( 'edit_post', get_the_ID() ) ) {
$url = admin_url( 'post.php?post='.$gallery_id.'&action=edit' );
$edit_gallery = __( 'edit gallery', 'aesop-core' );
printf( '
(%s)', $url, $edit_gallery, $edit_gallery );
}
}//end if
if ( empty( $gallery_id ) && is_user_logged_in() && current_user_can( 'edit_post', get_the_ID() ) ) {
if ( function_exists( 'lasso_editor_components' ) ) {
?>
icon above.', 'aesop-core' );
?>
data-keyboard="true"
data-allow-full-screen="native"
data-click="true">post_excerpt;
?>
;?>)
'aesop-grid-image' ) );
$img = get_post( $image_id );
$caption = $img->post_excerpt;
$img_title = $img->post_title;
$lightbox_text = "";
switch ($aesop_lightbox_text) {
case 'title': $lightbox_text = $img_title;break;
case 'caption': $lightbox_text = $caption;break;
case 'title_caption': $lightbox_text = $img_title."
".$caption;break;
case 'description': $lightbox_text = $img->post_content;break;
}
$getimagesrc = wp_get_attachment_image_src( $image_id, 'full' );
if (class_exists( 'AesopLazyLoader' )) {
$getimagesrc2 = wp_get_attachment_image_src( $image_id, 'aesop-grid-image' );
$lazy_holder = AI_CORE_URL.'/public/assets/img/aesop-lazy-holder.png';
$getimage = sprintf( '
',
esc_url( $getimagesrc2[0] ), esc_url( $getimagesrc2[0] ),
$getimagesrc2[1],$getimagesrc2[2] );
}
?>
-
instead of with
* `background-image`.
* Note that the AMP spec calls for
instead of
,
* but output
here and rely on the AMP plugin to replace
* the tags properly.
* @link https://wordpress.org/plugins/amp/
* @link https://www.ampproject.org/docs/reference/spec.html
*/
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
$size = apply_filters( 'aesop_stacked_gallery_size', 'full' );
foreach ( $image_ids as $image_id ):
$full = wp_get_attachment_image_src( $image_id, $size, false );
$caption = get_post( $image_id )->post_excerpt;
$alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true );
?>
post_excerpt;
?>
post_excerpt;
// lazy loading disabled for now
//$lazy = class_exists( 'AesopLazyLoader' ) ? sprintf( 'src="%s" data-src="%s" class="aesop-sequence-img aesop-lazy-img"', $lazy_holder, esc_url( $img[0] ) ) : sprintf( 'src="%s" class="aesop-sequence-img" ', esc_url( $img[0] ) );
$lazy = sprintf( 'src="%s" class="aesop-sequence-img" ', esc_url( $img[0] ) );
?>
alt="">
add_action( 'wp_footer', aesop_panorama, 20 );
post_excerpt;
?>
post_excerpt;
// lazy loading disabled for now
//$lazy = class_exists( 'AesopLazyLoader' ) ? sprintf( 'src="%s" data-src="%s" class="aesop-sequence-img aesop-lazy-img"', $lazy_holder, esc_url( $img[0] ) ) : sprintf( 'src="%s" class="aesop-sequence-img" ', esc_url( $img[0] ) );
$lazy = sprintf( 'src="%s" class="aesop-sequence-img" ', esc_url( $img[0] ) );
if (!$sequence_panorama) {
?>
alt="">
'; }
?>post_excerpt;
$title = $img->post_title;
$lightbox_text = "";
switch ($aesop_lightbox_text) {
case 'title': $lightbox_text = $title;break;
case 'caption': $lightbox_text = $caption;break;
case 'title_caption': $lightbox_text = $title."
".$caption;break;
case 'description': $lightbox_text = $img->post_content;break;
}
$lb_link = $lightbox ? sprintf('href="%s" title="%s"', esc_url( $full[0] ), esc_attr($lightbox_text)) : null;
if (class_exists( 'AesopLazyLoader' )) {
$lazy_holder = AI_CORE_URL.'/public/assets/img/aesop-lazy-holder.png';
$lazy = sprintf( 'src="%s" data-src="%s" class="aesop-lazy-img"', $lazy_holder, esc_url( $full[0] ) );
?>
![]()
data-caption="" data-title="" alt="">
;?>)
data-caption="" data-title="" alt="">
'; }
}
/**
* Draws a hero gallery using fotorama
*
* @since 1.0.0
*/
public function aesop_hero_gallery( $gallery_id, $image_ids, $width ) {
$trans = get_post_meta( $gallery_id, 'aesop_hero_gallery_transition', true );
$trans_speed = get_post_meta( $gallery_id, 'aesop_hero_gallery_transition_speed', true );
$trans_anim_speed = get_post_meta( $gallery_id, 'aesop_hero_gallery_transition_anim_speed', true );
// if hero option is not set use the thumb gallery option
$trans = $trans ? $trans : get_post_meta( $gallery_id, 'aesop_thumb_gallery_transition', true );
$trans_speed = $trans_speed ? $trans_speed : get_post_meta( $gallery_id, 'aesop_thumb_gallery_transition_speed', true );
$trans_speed = $trans_speed ? $trans_speed : 3000;
$trans_anim_speed = $trans_anim_speed ? $trans_anim_speed : 1200;
$autoplay = sprintf( 'data-autoplay=%s', $trans_speed, true );
$transition = $trans ? $trans : 'crossfade';
$content = get_post_meta( $gallery_id, 'aesop_hero_gallery_content', true ) ? get_post_meta( $gallery_id, 'aesop_hero_gallery_content', true) : '';
$height = get_post_meta( $gallery_id, 'aesop_hero_gallery_height', true ) ? get_post_meta( $gallery_id, 'aesop_hero_gallery_height', true) : '';
$enable_nav = get_post_meta( $gallery_id, 'aesop_hero_gallery_enable_nav', true ) ? get_post_meta( $gallery_id, 'aesop_hero_gallery_enable_nav', true) : false;
$image_text_op = get_post_meta( $gallery_id, 'aesop_hero_image_text', true ) ? get_post_meta( $gallery_id, 'aesop_hero_image_text', true) : false;
// image size
$size = apply_filters( 'aesop_thumb_gallery_size', 'full' );
if (empty($width)) {
$width = "100%";
}
if (empty($height)) {
$height = "100%";
} else {
if (strpos($height, '/') !== FALSE)
{
$ratio = 'data-ratio="'.$height.'"';
$height ="";
}
}
?>
data-keyboard="false"
data-allow-full-screen="false"
data-click="false"
data-fit="cover"
data-captions="true"
data-stopautoplayontouch="false"
data-nav="dots"
data-arrows="true"
data-swipe="true"
data-nav=false
data-arrows="false"
data-swipe="false"
data-transitionduration=""
>post_excerpt;
$image_text = "";
if ($image_text_op && $image_text_op != 'none') {
switch ($image_text_op) {
case 'title': $image_text = $img->post_title;break;
case 'caption': $image_text = $caption;break;
case 'title_caption': $image_text = $img->post_title."
".$caption;break;
case 'description': $image_text = $img->post_content;break;
}
?>