How to Add two Flex Sliders in Detail Page ?

This topic contains 2 replies, has 3 voices, and was last updated by  Paolo 8 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #51629

    Abhishek Modi
    Buyer
    Post count: 205

    Hi Just check the tuutorial of Social Sharing. From that i have added the code in my theme function.php. So that slider will come above social sharing button in listing Detail page. And it worked but the problem is any one slider is working. That’s either content slider or sidebar slider. Any Suggestion So that both Starts working..Here is the Code:

    
    
    
    /**
     * Wraps GeoDirectory Directory the sharing buttons div in our custom container
     *
     * @param string $content_html The HTML of the sharing buttons div
     * @return string Filtered HTML.
     */
    function my_theme_geodir_social_sharing_buttons_html( $content_html )
    {
        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);
            }
        }
    
        if ($preview) {
            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)) {
                $default_img = '';
                $default_cat = '';
    
                if (isset($post->post_default_category)) {
                    $default_cat = $post->post_default_category;
                }
    
                if ($default_catimg = geodir_get_default_catimage($default_cat, $post->listing_type)) {
                    $default_img = $default_catimg['src'];
                } else if ($no_images = get_option('geodir_listing_no_img')) {
                    $default_img = $no_images;
                }
    
                if (!empty($default_img)) {
                    $post_images[] = $default_img;
                }
            }
    
            if (!empty($post_images)) {
                foreach ($post_images as $image) {
                    if (!empty($image)) {
                        @list($width, $height) = getimagesize(trim($image));
    
                        if ($image && $width && $height) {
                            $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
                        }
    
                        if (isset($image->src)) {
                            if ($image->height >= 200) {
                                $spacer_height = 0;
                            } else {
                                $spacer_height = ((200 - $image->height) / 2);
                            }
    
                            $image_title = isset($image->title) ? $image->title : '';
    
                            $main_slides .= '<li><img src="' . geodir_plugin_url() . "/hangoutflavours-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
                            $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:200px;margin:0 auto;" /></li>';
                            $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
                            $slides++;
                        }
                    }
                }// endfore
            } //end if
        } else {
            $main_slides = '';
            $nav_slides = '';
            $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
            $slides = 0;
    
            if (empty($post_images) && get_option('geodir_listing_no_img')) {
                $post_images = (object)array((object)array('src' => get_option('geodir_listing_no_img')));
            }
    
            if (!empty($post_images)) {
                foreach ($post_images as $image) {
                    if ($image->height >= 200) {
                        $spacer_height = 0;
                    } else {
                        $spacer_height = ((200 - $image->height) / 2);
                    }
    
                    $main_slides .= '<li><img src="' . geodir_plugin_url() . "/hangoutflavours-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
                    $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:200px;margin:0 auto;" itemprop="image"/></li>';
                    $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
                    $slides++;
                }
            }// endfore
        }
    
        if (!empty($post_images)) {
            ?>
            <div class="geodir_flex-container">
                <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
                <div id="geodir_slider" class="geodir_flexslider ">
                    <ul class="geodir-slides clearfix"><?php echo $main_slides; ?></ul>
                </div>
                <?php if ($slides > 1) { ?>
                    <div id="geodir_carousel" class="geodir_flexslider">
                        <ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
                    </div>
                <?php } ?>
            </div>
        <?php
    
        }
    	
    	return "<div class='my-theme-class'>".$thumb."</div>".$content_html;
    	
    	
    }
    
    add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
    add_filter( 'geodir_social_sharing_buttons_html', 'my_theme_geodir_social_sharing_buttons_html', 10, 1 );
    
    

    Thanks

    #51635

    Guust
    Moderator
    Post count: 29970

    I don’t think 2 sliders can work on the same page, but I’ll get Paolo to have a look too.

    #51685

    Paolo
    Site Admin
    Post count: 31206

    It is not possible. The script will only work on one of the two.

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket