_meta( $id ,'_portfolio_custom_link', true ) != '' ? get_post_meta( $id , '_portfolio_custom_link_url', true ) : get_permalink( $id ); //merge default and params array. remove empty params with array_filter $params = array_merge( $defaults, array_filter( $params ) ); $params = apply_filters( 'avf_portfolio_preview_template_params', $params, $entry ); global $avia_config; /** * Fullwidth shortcodes like "Fullwidth Button" will break layout because they create an own section. * This allows to return without creating new sections * * @since 4.7.6.4 */ if( ! isset( $avia_config['portfolio_preview_template'] ) ) { $avia_config['portfolio_preview_template'] = 0; } $avia_config['portfolio_preview_template'] ++; //set the content $content = str_replace( ']]>', ']]>', apply_filters( 'the_content', $params['text'] ) ); unset( $params['text'] ); if( isset( $avia_config['portfolio_preview_template'] ) ) { $avia_config['portfolio_preview_template'] --; if( $avia_config['portfolio_preview_template'] <= 0 ) { unset( $avia_config['portfolio_preview_template'] ); } } //set images $string = ''; //set first class if preview images are deactivated $nogalleryclass = ''; $params['ajax_request'] = true; switch( $params['method'] ) { case 'gallery': $params['style'] = 'big_thumb'; $params['thumb_size'] = 'square'; foreach( $params as $key => $param ) { $string .= $key . "='" . $param . "' "; } $images = do_shortcode( "[av_gallery {$string}]" ); break; case 'slideshow': $params['size'] = $params['preview_size']; foreach( $params as $key => $param ) { $string .= $key . "='" . $param . "' "; } $images = do_shortcode( "[av_slideshow {$string}]" ); break; case 'list': $images = $this->post_images( $params['ids'] ); break; case 'no': $images = false; $nogalleryclass = ' no_portfolio_preview_gallery '; break; } $output .= "
'; return "\n\n"; } /** * * @param string $ids * @return string */ protected function post_images( $ids ) { if( empty( $ids ) ) { return; } $attachments = get_posts( array( 'include' => $ids, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'post__in' ) ); $output = ''; foreach( $attachments as $attachment ) { // create array with responsive info for lightbox $img = Av_Responsive_Images()->responsive_image_src( $attachment->ID, 'large' ); $alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ); $alt = ! empty( $alt ) ? esc_attr( $alt ) : ''; $title = trim( $attachment->post_title ) ? esc_attr( $attachment->post_title ) : ''; $description = trim( $attachment->post_content ) ? esc_attr( $attachment->post_content ) : ''; $img_tag = "