print_render_attribute_string( 'carousel-wrapper' ); ?>>
print_render_attribute_string( 'carousel' ); ?>>
render_swiper_button( 'previous' ); ?>
render_swiper_button( 'next' ); ?>
wp_get_attachment_url( $attachment['id'] ),
];
}
/**
* Retrieve image carousel caption.
*
* @since 1.2.0
* @access private
*
* @param array $attachment
*
* @return string The caption of the image.
*/
private function get_image_caption( $attachment ) {
$caption_type = $this->get_settings_for_display( 'caption_type' );
if ( empty( $caption_type ) ) {
return '';
}
$attachment_post = get_post( $attachment['id'] );
if ( 'caption' === $caption_type ) {
return $attachment_post->post_excerpt;
}
if ( 'title' === $caption_type ) {
return $attachment_post->post_title;
}
return $attachment_post->post_content;
}
private function render_swiper_button( $type ) {
$direction = 'next' === $type ? 'right' : 'left';
$icon_settings = $this->get_settings_for_display( 'navigation_' . $type . '_icon' );
if ( empty( $icon_settings['value'] ) ) {
$icon_settings = [
'library' => 'eicons',
'value' => 'eicon-chevron-' . $direction,
];
}
Icons_Manager::render_icon( $icon_settings, [ 'aria-hidden' => 'true' ] );
}
}