= '4' ) {
$image_size = 'column3-2/3';
} else {
$image_size = 'column2-1/2';
}
} else {
if ( $columns == '1' ) {
$image_size = 'column1-2/3';
} else if ( $columns == '2' ) {
$image_size = 'column2-2/3';
} else if ( $columns == '3' ) {
$image_size = 'column3-2/3';
} else if ( $columns >= '4' ) {
$image_size = 'column4-2/3';
} else {
$image_size = 'column2-1/2';
}
}
// Assign column layout class
if ( $columns == '2' ) {
$class_column = 'column-2';
} else if ( $columns == '3' ) {
$class_column = 'column-3';
} else if ( $columns == '4' ) {
$class_column = 'column-4';
} else if ( $columns == '5' ) {
$class_column = 'column-5';
} else if ( $columns == '6' ) {
$class_column = 'column-6';
} else {
$class_column = 'column-4';
}
// Assign class for screen wide layout
if ( $wide == 'on' ) {
$class_wide = ' grid-wide';
}
// Assign class to hide on mobile devices
if ( $mobile_hide == 'yes' ) {
$class_hide = ' hidden-mobile';
}
$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'numberposts' => $items,
'order' => $order,
'category' => $category,
);
$recent_posts = wp_get_recent_posts( $args );
echo '
';
echo '
';
global $wp_embed;
foreach( $recent_posts as $recent ){
$post_id = get_post_thumbnail_id( $recent["ID"] );
$post_img = wp_get_attachment_image_src($post_id, $image_size, true);
$post_img_full = wp_get_attachment_image_src($post_id, 'full', true);
// Do not show post if default WordPress image is being used (e.g. no feautured image set)
if ( strpos( $post_img[0], 'wp-includes/images/media/default.png' ) !== false ) {
$post_id = NULL;
}
$thinkup_input_featured = '
';
$thinkup_input_link = $post_img_full[0];
// Set link icon variable if user wants it to show
if ( $link_icon !== 'off' ) {
$link_input = '';
}
// Set lightbox icon variable if user wants it to show
if ( $lightbox_icon !== 'off' ) {
$lightbox_input = '';
}
// Determine which if single link animation should be shown
if ( $link_icon == 'off' or $lightbox_icon == 'off' ) {
$overlay_class = ' style2';
}
if ( $link_icon !== 'off' or $lightbox_icon !== 'off' ) {
$overlay_input = NULL;
$overlay_input .= '';
$overlay_input .= '
';
$overlay_input .= '
';
$overlay_input .= $lightbox_input;
$overlay_input .= $link_input;
$overlay_input .= '
';
$overlay_input .= '
';
$overlay_input .= '
';
}
if ( ! empty( $post_id ) ) {
$count++;
// Assign last class to column layouts
if ( $count % $columns == 0 ) {
$class_column_last = ' last';
} else {
$class_column_last = NULL;
}
// Assign animation variables if set
if ( ! empty( $animate ) and $animate !== 'none' ) {
// Assign delay variable
if ( ! empty( $delay_item ) and $count > 1 ) {
$delay = $delay + $delay_item;
}
$animate_start = '';
$animate_end = '
';
}
echo '- ';
echo $animate_start;
echo '';
echo $animate_end;
echo '
';
}
}
echo '',
'
',
'
';
// Load animation styles and scripts
if ( ! empty( $animate ) and $animate !== 'none' ) {
if ( ! wp_script_is( 'animate-js', 'enqueued' ) ) {
// Enque styles only if widget is being used
wp_enqueue_style( 'animate-css', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'inc/plugins/animate.css/animate.css', array(), '1.0' );
wp_enqueue_style( 'animate-thinkup-css', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'widgets-builder/animation/css/animate-thinkup-panels.css', array(), '1.0' );
if ( ! wp_script_is( 'waypoints', 'enqueued' ) ) {
// Enque waypoints only if widget is being used
wp_enqueue_script( 'waypoints', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'inc/plugins/waypoints/waypoints.min.js', array( 'jquery' ), '2.0.3', 'true' );
wp_enqueue_script( 'waypoints-sticky', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'inc/plugins/waypoints/waypoints-sticky.min.js', array( 'jquery' ), '2.0.3', 'true' );
}
// Enque scripts only if widget is being used
wp_enqueue_script( 'animate-js', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'widgets-builder/animation/js/animate-thinkup-panels.js', array( 'jquery' ), '1.1', true );
}
}