Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dilll

    (@dilll)

    Actually most of the booking item data is saved in the post meta table.
    You can get item images simply by calling method get_post_meta( $post->ID, 'images', true)
    The result should be something like this:
    array (
        0 => 
        array (
          'image_id' => 253, // the post ID of the image
          'image' => '/wp-content/uploads/2022/10/image.jpg',
          'description' => 'Image description',
        ),
      )

    – This is the answer from author plugin. It’s basically what you were talking about. But I do not quite understand how to turn it on correctly. Can you help?

    Thread Starter dilll

    (@dilll)

    <div class="content-top">
                      <!--<?php echo BABE_Rating::post_stars_rendering($post_id); ?>-->
    
                      <?php 
                      $images = isset($ba_post['images']) && $ba_post['images'] ? $ba_post['images'] : false;
                      $video  = isset($ba_post['tevily_booking_video']) ? $ba_post['tevily_booking_video'] : false;
                      if($video || $images): ?>
                         <div class="ba-media">
    
                            <?php 
                            if($images){
                               $i = 1;
                               foreach($images as $image){ 
                                  $classes = ($i>1) ? 'hidden' : 'ba-gallery';
                                  if( isset(wp_get_attachment_image_src($image['image_id'], 'full')[0]) ){ ?>
                                     <a class="<?php echo esc_attr($classes) ?>" href="<?php echo esc_url(wp_get_attachment_image_src($image['image_id'], 'full')[0]) ?>" data-elementor-lightbox-slideshow="<?php echo esc_attr($_rand) ?>">
                                        <?php 
                                           if($i == 1){
                                              echo '<i class="las la-camera"></i>';
                                              echo '<span>' . count($images) . '</span>';
                                           }
                                        ?>
                                     </a>
                                  <?php }  
                                  $i = $i + 1;
                               }
                            } 
                            ?>
    
                            <?php if($video){ ?>
                               <a class="ba-video popup-video" href="<?php echo esc_url($video) ?>"><i class="las la-video"></i></a>
                            <?php } ?>
    
                         </div>
                      <?php endif; ?>
                   </div>

    @bcworkz
    I found another function that also calls the same photos, only this is for viewing in full screen mode.
    If I somehow call and write to my array in the same way, will it help me?

    • This reply was modified 3 years, 6 months ago by dilll.
    Thread Starter dilll

    (@dilll)

    <?php
    $_rand      = wp_rand(5);
    $thumbnail  = isset($settings['image_size']) && $settings['image_size'] ? $settings['image_size'] : 'tevily_medium';
    $post_id    = $post['ID'];
    $ba_post    = BABE_Post_types::get_post($post_id);
    $url        = BABE_Functions::get_page_url_with_args($post_id, $_GET);
    $image      = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $thumbnail);
    
    ?>
    
    <section class="s-top-bunner b-zoom-gallery">
    
      <div class="b-zoom-gallery_main">
        <div class="b-zoom-gallery_main_big-image">
          <img src="<?php echo esc_url($image[0]) ?>" alt="<?php echo esc_attr( $post['post_title'] ) ?>" class="image1">
        </div>

    Here the image is passed, as I understand it, this is the featured image. But I need it from slider

    Thread Starter dilll

    (@dilll)

    public static function shortcode_item_slideshow( $atts, $content = null ) {
    
            global $post;
    
            $output = '';
    
            if ( is_single() && $post->post_type == BABE_Post_types::$booking_obj_post_type) {
    
                $args = shortcode_atts( array(
                    'title'      => '',
                ), $atts, 'babe-item-slideshow' );
    
                $babe_post = BABE_Post_types::get_post($post->ID);
    
                $output .= BABE_html::block_slider($babe_post);
    
            }
    
            return $output;
        }

    @bcworkz Here is the shortcode in the plugin itself. As I understand it, it is transmitted here: $output .= BABE_html::block_slider($babe_post); but I don’t understand what it gives me. Unfortunately plugin support is not responding.

    Thank you for answer!

    Thread Starter dilll

    (@dilll)

    **
    	 * Add unitegallery to booking_obj page.
         * @param array $post - we're looking for $post['images'] array here
         * @return string
    	 */
        public static function block_slider($post){
        
        $output = '';
        
        $files = isset($post['images']) ? (array)$post['images'] : array();
    
        if(!BABE_Settings::$settings['unitegallery_remove'] && !empty($files)){
            
          $thumbnail = apply_filters('babe_slider_img_thumbnail', 'thumbnail');
          $full = apply_filters('babe_slider_img_full', 'full');     
          // Loop through them and output an image
          foreach ( $files as $file ) {
            if (is_array($file) && isset($file['image_id']) && $file['image_id']){
            $image_full_arr = wp_get_attachment_image_src( $file['image_id'], $full );
            $image_thumb_arr = wp_get_attachment_image_src( $file['image_id'], $thumbnail );
            $description = isset($file['description']) && $file['description'] ? ' data-description="'.$file['description'].'"' : '' ;
            
            $output .= '
            <img src="'.$image_thumb_arr[0].'" />
            ';
            }
          } //// end foreach
          
          if ($output){
            
             $unitegallery_settings = BABE_Settings::$unitegallery;
             $js_arr = array();
             
             foreach($unitegallery_settings as $key => $value){
                
                if ($value === null){
                    $value_str = 'null';
                } elseif ($value === true){
                    $value_str = 'true';
                } elseif ($value === false){
                    $value_str = 'false';
                } elseif (is_float($value) || is_int($value)){
                    $value_str = $value;
                } else {
                    $value_str = '"'.$value.'"';
                }
                
                $js_arr[] = $key.':'.$value_str;
             }
             $js = implode(', ', $js_arr);
    
             $add_class = !empty(BABE_Settings::$settings['content_in_tabs']) ? ' babe_slider_tabs_content' : '';
    
             $output = '
             <div class="babe_slider'.$add_class.'" id="unitegallery" style="display:none;">
                 '.$output.'
             </div>
             ';
          }
        
        }
        
        return $output;
    }

    I found a function that uses an array of photos that I need.

    Tell me how to call the same array of photos?

    • This reply was modified 3 years, 6 months ago by dilll.
Viewing 5 replies - 1 through 5 (of 5 total)