*/ global $post,$canuck_feature_pic_count; $category = esc_html( ( '' === get_post_meta( $post->ID, 'canuck_portfolio_category', true ) ? false : get_post_meta( $post->ID, 'canuck_portfolio_category', true ) ) ); $display_post_content = ( ( '' === get_post_meta( $post->ID, 'canuck_metabox_include_post_content', true ) ? false : true ) ); $display_post_content_title = ( ( '' === get_post_meta( $post->ID, 'canuck_metabox_include_post_content_title', true ) ? false : true ) ); $display_image_caption = ( ( '' === get_post_meta( $post->ID, 'canuck_metabox_include_image_caption', true ) ? false : true ) ); $display_image_description = ( ( '' === get_post_meta( $post->ID, 'canuck_metabox_include_image_description', true ) ? false : true ) ); $canuck_portfolio_type = sanitize_text_field( ( '' === get_post_meta( $post->ID, 'canuck_portfolio_type', true ) ? 'grid3' : get_post_meta( $post->ID, 'canuck_portfolio_type', true ) ) ); $include_pinterest_pinit = get_theme_mod( 'canuck_include_pinit' ) ? true : false; $category_id = get_cat_ID( $category ); $args = array( 'category' => $category_id, 'numberposts' => 20, ); $custom_posts = get_posts( $args ); $use_lazyload = get_theme_mod( 'canuck_use_lazyload' ) ? true : false; if ( 0 !== $category_id && $custom_posts ) { $canuck_feature_pic_count = 0; foreach ( $custom_posts as $post ) { // phpcs:ignore setup_postdata( $post ); $link_to_post = ( '' === get_post_meta( $post->ID, 'canuck_metabox_link_to_post', true ) ? false : true ); $custom_feature_link = ( '' === get_post_meta( $post->ID, 'canuck_custom_feature_link', true ) ? false : get_post_meta( $post->ID, 'canuck_custom_feature_link', true ) ); $image_url = get_the_post_thumbnail_url( $post->ID, 'canuck_med15' ); $image_caption = get_post( get_post_thumbnail_id() )->post_excerpt; $image_desc = get_post( get_post_thumbnail_id() )->post_content; if ( has_post_thumbnail() ) { $canuck_feature_pic_count ++; ?>
<?php echo esc_attr( $image_caption ); ?> <?php echo esc_attr( $image_caption ); ?> <?php echo esc_attr( $image_caption ); ?> <?php echo esc_attr( $image_caption ); ?>
' . esc_attr__( 'Pinterest share image', 'canuck' ) . ''; // url ok. } if ( false !== $custom_feature_link ) { echo ''; } elseif ( true === $link_to_post ) { echo ''; } ?>
'; } } elseif ( 'grid3' === $canuck_portfolio_type ) { if ( is_int( ( $canuck_feature_pic_count ) / 3 ) ) { echo '
'; } } elseif ( 'grid4' === $canuck_portfolio_type ) { if ( is_int( ( $canuck_feature_pic_count ) / 4 ) ) { echo '
'; } } elseif ( 'grid5' === $canuck_portfolio_type ) { if ( is_int( ( $canuck_feature_pic_count ) / 5 ) ) { echo '
'; } } }// End foreach(). } else { ?>