GeoDirectory SupportHow to Add two Flex Sliders in Detail Page ? – GeoDirectory Support https://wpgeodirectory.com/support/topic/how-to-add-two-flex-sliders-in-detail-page/feed Sat, 07 Mar 2026 15:07:13 +0000 http://bbpress.org/?v=2.5.14-6684 en-US https://wpgeodirectory.com/support/topic/how-to-add-two-flex-sliders-in-detail-page/#post-51629 <![CDATA[How to Add two Flex Sliders in Detail Page ?]]> https://wpgeodirectory.com/support/topic/how-to-add-two-flex-sliders-in-detail-page/#post-51629 Tue, 01 Sep 2015 21:26:33 +0000 Abhishek Modi 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

]]>
https://wpgeodirectory.com/support/topic/how-to-add-two-flex-sliders-in-detail-page/#post-51635 <![CDATA[Reply To: How to Add two Flex Sliders in Detail Page ?]]> https://wpgeodirectory.com/support/topic/how-to-add-two-flex-sliders-in-detail-page/#post-51635 Tue, 01 Sep 2015 22:24:00 +0000 Guust I don’t think 2 sliders can work on the same page, but I’ll get Paolo to have a look too.

]]>
https://wpgeodirectory.com/support/topic/how-to-add-two-flex-sliders-in-detail-page/#post-51685 <![CDATA[Reply To: How to Add two Flex Sliders in Detail Page ?]]> https://wpgeodirectory.com/support/topic/how-to-add-two-flex-sliders-in-detail-page/#post-51685 Wed, 02 Sep 2015 14:35:21 +0000 Paolo It is not possible. The script will only work on one of the two.

Thanks

]]>