Function Reference: geodir_action_details_slider
Summary
Output the details page slider HTML.
Global Values
- $preview
- (bool) (required) True of on a preview page. False if not.
- Default: None
- $post
- (object) (required) The current post object.
- Default: None
Package
GeoDirectory
Change Log
Since: 1.0.0
1.5.4 itemprop=”image” removed as added via JSON-LD.
1.5.7 Hide default image on listing detail preview page.
Source File
geodir_action_details_slider() is located in geodirectory_template_actions.php [Line: 995]
Source Code
function geodir_action_details_slider() { global $preview, $post; $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) { $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img')); $preview_post_images = array(); if ($preview_get_images) { foreach ($preview_get_images as $row) { $preview_post_images[] = $row->src; } } if (!empty($preview_post_images)) { $post->post_images = implode(',', $preview_post_images); } } $package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : '')); $image_limit = ''; if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') { $image_limit = (int)$package_info->image_limit; } if ($preview) { $post_images = array(); if (isset($post->post_images) && !empty($post->post_images)) { $post->post_images = trim($post->post_images, ","); $post_images = explode(",", $post->post_images); } $main_slides = ''; $nav_slides = ''; $slides = 0; if (!empty($post_images)) { foreach ($post_images as $image) { if ($image_limit !== '' && ($slides+1) > $image_limit) { break; } if (!empty($image)) { $sizes = getimagesize(trim($image)); $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0; $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; if ($image && $width && $height) { $image = (object)array('src' => $image, 'width' => $width, 'height' => $height); } if (isset($image->src)) { if ($image->height >= 400) { $spacer_height = 0; } else { $spacer_height = ((400 - $image->height) / 2); } $image_title = isset($image->title) ? $image->title : ''; $main_slides .= '
'.$image->caption.'
' : ''; $main_slides .= '
1) { ?>