Paolo

Forum Replies Created

Viewing 15 posts - 4,186 through 4,200 (of 27,715 total)
  • Author
    Posts
  • in reply to: manager v2 and capahca #387100

    Paolo
    Site Admin
    Post count: 31211

    hi,

    all your GeoDirectory plugin including the core plugin are extremely old. We only provide support for the latest version.

    Please update the core plugin and make sure to update all add-ons too.

    You’ll have to update via FTP or using a plugin like this https://wordpress.org/plugins/easy-theme-and-plugin-upgrades/ because what you have installed still uses an old updating script.

    After everything is updated, I’m sure you’ll be able to install the re-CAPTCHA plugin correctly.

    Let us know how it goes,

    Thanks

    in reply to: Repeat Detail Page tab head #387095

    Paolo
    Site Admin
    Post count: 31211

    Hi,

    this can probably be done via hooks. i asked to the developers to check and let us know the best way to do this.

    They’ll let you know asap.

    Thanks

    in reply to: adding the "sort by prices" dificulties #387093

    Paolo
    Site Admin
    Post count: 31211

    I’m not 100% sure, but I believe the problem is simple, you can’t assign the same order to 2 or more prices.

    Try to assign each a unique position and see if that works.

    Thanks

    in reply to: Reset Location #387089

    Paolo
    Site Admin
    Post count: 31211

    Add a text widget below the search form and paste this in it:

    <a href="/location/">Reset Location</a>

    With css you can make that a button and place it where you prefer.

    Thanks

    in reply to: adding the "sort by prices" dificulties #387085

    Paolo
    Site Admin
    Post count: 31211

    Or provide FTP credentials where we can see your code directly.

    Thanks

    in reply to: 404 error on listing #387084

    Paolo
    Site Admin
    Post count: 31211

    Hi,

    all listings must be assigned to at least 1 category. You didn’t even have an event category, so I created it and now everything works.

    Thanks

    in reply to: Profile picture #387081

    Paolo
    Site Admin
    Post count: 31211

    Hi,

    in the 1st case the avatar becomes visible only if you mark that author as the listing owner after enabling the claim listing plugin.

    Thanks

    in reply to: I see white display for logging in wp-admin #387077

    Paolo
    Site Admin
    Post count: 31211

    Hi,

    please provide admin credentials in a private reply.

    next time don’t paste an entire template code in the forum. Either paste it in a txt file or wrap it code tags at least.

    Thanks

    in reply to: I see white display for logging in wp-admin #387075

    Paolo
    Site Admin
    Post count: 31211
    
    
    ================================================================================
     <?php
    /**
     * Functions for the GeoDirectory plugin if installed
     *
     * @since 1.0.0
     * @package Supreme_Directory
     */
    
    /*
     * remove breadcrumb from search, listings and detail page.
     */
    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
    
    /*
     * add search widget on top of search results and in listings page.
     */
    function sd_before_listing_content_search()
    {
        if (sd_is_non_location_cpt()) {
            return;
        }
        add_action('geodir_search_content', 'sd_search_form_on_search_page', 4);
        add_action('geodir_listings_content', 'sd_search_form_on_search_page', 4);
    }
    
    add_action('wp', 'sd_before_listing_content_search');
    
    /**
     * Outputs the search form.
     *
     * @since 1.0.0
     */
    function sd_search_form_shortcode()
    {
        $shortcode_args = array(
            
        );
    
        $shortcode_args = apply_filters('sd_search_shortcode_args', $shortcode_args);
    
        $arg_string = array();
        foreach ($shortcode_args as $key => $value) {
            $arg_string[] = $key.'='.$value;
        }
        $imploded_args = implode(' ', $arg_string);
    
        $shortcode_string = '[gd_advanced_search '.$imploded_args.']';
        echo do_shortcode($shortcode_string);
    }
    
    /**
     * Outputs the search widget.
     *
     * @since 1.0.0
     */
    function sd_search_form_on_search_page()
    {
        sd_search_form_shortcode();
    }
    
    /**
     * Add body classes to the HTML where needed.
     *
     * @since 0.0.1
     *
    *@param array $classes The array of body classes.
     *
    *@return array The array of body classes.
     */
    function sd_custom_body_class_gd($classes)
    {
        if (geodir_is_page('location')) {
            $classes[] = 'sd-location';
        } elseif (geodir_is_page('preview')) {
            $classes[] = 'sd-preview';
        } elseif (geodir_is_page('listing')) {
            if (get_option('geodir_show_listing_right_section', true)) {
                $classes[] = 'sd-right-sidebar';
            } else {
                $classes[] = 'sd-left-sidebar';
            }
        } elseif (geodir_is_page('add-listing')) {
            $classes[] = 'sd-add';
        }
    
        // remove 'sd' class if location-less CPT
        if (sd_is_non_location_cpt()) {
            if(($key = array_search('sd', $classes)) !== false) {
                unset($classes[$key]);
            }
        }
    
        return $classes;
    }
    
    add_filter('body_class', 'sd_custom_body_class_gd',11,1);
    
    /**
     * Remove and change some standard GeoDirectory widget areas.
     *
     * This function disables the listings pages sidebars and uses the GeoDirectory design setting to select map left/right
     * on listings pages.
     *
     * @since 1.0.0
     */
    function sd_theme_actions()
    {
    
        if (sd_is_non_location_cpt()) {
            return;
        }
    
        unregister_sidebar('geodir_listing_left_sidebar');
        unregister_sidebar('geodir_listing_right_sidebar');
    
        unregister_sidebar('geodir_search_left_sidebar');
        unregister_sidebar('geodir_search_right_sidebar');
    
        if(isset($_REQUEST['geodir_dashbord'])){
    	    unregister_sidebar('geodir_author_left_sidebar');
    	    unregister_sidebar('geodir_author_right_sidebar');
        }
    
        // listings page
        if (get_option('geodir_show_listing_right_section', true)) {
            add_action('geodir_listings_sidebar_right_inside', 'sd_map_show');
            remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10);
        } else {
            add_action('geodir_listings_sidebar_left_inside', 'sd_map_show');
            remove_action('geodir_listings_sidebar_right', 'geodir_action_listings_sidebar_right', 10);
        }
    
        // search page
        if (get_option('geodir_show_search_right_section', true)) {
            add_action('geodir_search_sidebar_right_inside', 'sd_map_show');
            remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10);
        } else {
            add_action('geodir_search_sidebar_left_inside', 'sd_map_show');
            remove_action('geodir_search_sidebar_right', 'geodir_action_search_sidebar_right', 10);
        }
    
        // author page
        if (get_option('geodir_show_author_right_section', true)) {
            if(isset($_REQUEST['geodir_dashbord'])){
                add_action('geodir_author_sidebar_right_inside', 'sd_map_show');
            }
            remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10);
        } else {
            if(isset($_REQUEST['geodir_dashbord'])){
                add_action('geodir_author_sidebar_left_inside', 'sd_map_show');
            }
            remove_action('geodir_author_sidebar_right', 'geodir_action_author_sidebar_right', 10);
        }
    
    }
    
    add_action('wp', 'sd_theme_actions', 15);
    
    /**
     * Output the listing map widget.
     *
     * @since 1.0.0
     */
    function sd_map_show()
    {
        $shortcode_args = array(
            'width' => '100%',
            'autozoom' => 'true'
        );
    
        $shortcode_args = apply_filters('sd_map_shortcode_args', $shortcode_args);
    
        $arg_string = array();
        foreach ($shortcode_args as $key => $value) {
            $arg_string[] = $key.'='.$value;
        }
        $imploded_args = implode(' ', $arg_string);
    
        $shortcode_string = '[gd_listing_map '.$imploded_args.']';
        echo do_shortcode($shortcode_string);
    }
    
    /**
     * Output the mobile map buttons HTML.
     *
     * @since 1.0.0
     */
    function sd_mobile_map_buttons()
    {
        echo '<div class="sd-mobile-search-controls">
    			<a href="#">
    				<i class="fa fa-search"></i> ' . __('SEARCH LISTINGS', 'supreme-directory') . '</a>
    			<a href="#"><i class="fa fa-th-large">
    				</i> ' . __('SHOW LISTINGS', 'supreme-directory') . '</a>
    			<a href="#"><i class="fa fa-map-o">
    				</i> ' . __('SHOW MAP', 'supreme-directory') . '</a>
    			</div>';
    }
    
    add_action('geodir_listings_content', 'sd_mobile_map_buttons', 5);
    add_action('geodir_search_content', 'sd_mobile_map_buttons', 5);
    
    /*################################
          DETAIL PAGE FUNCTIONS
    ##################################*/
    
    // remove the preview page code to move it inside the featured area
    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_preview_code', 9);
    
    add_action('sd_details_featured_area_text','sd_add_event_dates_featured_area');
    function sd_add_event_dates_featured_area(){
        global $post,$geodir_date_format,$geodir_date_time_format;
        ?>
    
        <div class="header-wrap sd-event-dates-head">
            <?php do_action('sd_detail_header_wrap_inner'); ?>
            <?php
    
            $output = '';
            if(isset($post->recurring_dates)){
                $recuring_data = maybe_unserialize( $post->recurring_dates );
    //print_r($recuring_data);
                if ( !empty( $recuring_data ) && ( isset( $recuring_data['event_recurring_dates'] ) && $recuring_data['event_recurring_dates'] != '' ) || ( isset( $post->is_recurring ) && !empty( $post->is_recurring ) ) ) {
                    $event_recurring_dates = explode( ',', $recuring_data['event_recurring_dates'] );
                    $geodir_num_dates = 0;
                    $starttimes = '';
                    $endtimes = '';
                    $astarttimes = array();
                    $aendtimes = array();
    
                    // Check recurring enabled
                    $recurring_pkg = geodir_event_recurring_pkg( $post );
    
                    $hide_past_dates = true;
    
                    if ( !isset( $recuring_data['repeat_type'] ) ) {
                        $recuring_data['repeat_type'] = 'custom';
                    }
    
                    $repeat_type = isset( $recuring_data['repeat_type'] ) && in_array( $recuring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recuring_data['repeat_type'] : 'year'; // day, week, month, year, custom
    
                    $different_times = isset( $recuring_data['different_times'] ) && !empty( $recuring_data['different_times'] ) ? true : false;
    
                    if ( $repeat_type == 'custom' && $different_times ) {
                        $astarttimes = isset( $recuring_data['starttimes'] ) ? $recuring_data['starttimes'] : array();
                        $aendtimes = isset( $recuring_data['endtimes'] ) ? $recuring_data['endtimes'] : array();
                    } else {
                        $starttimes = isset( $recuring_data['starttime'] ) ? $recuring_data['starttime'] : '';
                        $endtimes = isset( $recuring_data['endtime'] ) ? $recuring_data['endtime'] : '';
                    }
    
                    if(isset($_REQUEST['gde']) && $_REQUEST['gde']){
                        //print_r($event_recurring_dates);
                        if(in_array($_REQUEST['gde'],$event_recurring_dates)){
                            $event_recurring_dates = array(esc_html($_REQUEST['gde']));
                        }
                    }
    
                    foreach( $event_recurring_dates as $key => $date ) {
                        $geodir_num_dates++;
    
                        if ( $repeat_type == 'custom' && $different_times ) {
                            if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
                                $starttimes = $astarttimes[$key];
                                $endtimes = $aendtimes[$key];
                            } else {
                                $starttimes = '';
                                $endtimes = '';
                            }
                        }
    
                        $duration = isset( $recuring_data['duration_x'] ) && (int)$recuring_data['duration_x'] > 0 ? (int)$recuring_data['duration_x'] : 1;
                        $duration--;
                        $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
    
                        // Hide past dates
                        if ( $hide_past_dates && strtotime( $enddate ) < strtotime( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) ) ) {
                            $geodir_num_dates--;
                            continue;
                        }
    
                        $sdate = strtotime( $date . ' ' . $starttimes );
                        $edate = strtotime( $enddate . ' ' . $endtimes );
    
                        $start_date = date_i18n( $geodir_date_time_format, $sdate );
                        $end_date = date_i18n( $geodir_date_time_format, $edate );
    
                        $full_day = false;
                        $same_datetime = false;
    
                        if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
                            $full_day = true;
                        }
    
                        if ( $start_date == $end_date && $full_day ) {
                            $same_datetime = true;
                        }
    
                        $link_date = date_i18n( 'Y-m-d', $sdate );
                        $title_date = date_i18n( $geodir_date_format, $sdate );
                        if ( $full_day ) {
                            $start_date = $title_date;
                            $end_date = date_i18n( $geodir_date_format, $edate );
                        }
    
                        $recurring_class = 'gde-recurr-link';
                        $recurring_class_cont = 'gde-recurring-cont';
                        if ( isset( $_REQUEST['gde'] ) && $_REQUEST['gde'] == $link_date ) {
                            $recurring_event_link = 'javascript:void(0);';
                            $recurring_class .= ' gde-recurr-act';
                            $recurring_class_cont .= ' gde-recurr-cont-act';
                        }
    
                        $output .= '<p class="' . esc_attr($recurring_class_cont) . '">';
                        $output .= '<span class="geodir_schedule_start"><i class="fa fa-caret-right"></i> ' . esc_attr($start_date). '</span>';
                        if ( !$same_datetime ) {
                            $output .= '<br />';
                            $output .= '<span class="geodir_schedule_end"><i class="fa fa-caret-left"></i> ' . esc_attr($end_date). '</span>';
                        }
                        $output .= '</p>';
                        if($geodir_num_dates>0){break;}
                    }
                }
    
                echo $output;
    
            }
    
            ?>
        </div>
        <?php
    
    }
    
    add_action('geodir_wrapper_open', 'sup_add_feat_img_head', 4, 1);
    
    //remove title from listing detail page
    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
    //remove slider from listing detail page
    remove_action('geodir_details_main_content', 'geodir_action_details_slider', 30);
    
    /**
     * Remove details info from sidebar.
     *
     * @since 1.0.0
     * @return array
     */
    function my_change_sidebar_content_order($arr)
    {
    
        $arr = array_diff($arr, array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_review_rating'));
    
        return $arr;
    }
    
    add_filter('geodir_detail_page_sidebar_content', 'my_change_sidebar_content_order',10,1);
    
    // Remove taxonomies from detail page content
    remove_action('geodir_details_main_content', 'geodir_action_details_taxonomies', 40);
    
    /**
     * Output the listings images as a gallery.
     *
     * Used to add the listins images to the sidebar.
     *
     * @since 1.0.0
     */
    function sd_img_gallery_output()
    {
        $excluded_tabs = get_option('geodir_detail_page_tabs_excluded',true);
        if(is_array($excluded_tabs) && in_array('post_images',$excluded_tabs)){
            global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
    
            $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
            $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
            $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
    
            if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
                $post = geodir_get_post_info($request_post_id);
                setup_postdata($post);
            }
    
            $geodir_post_detail_fields = geodir_show_listing_info('detail');
    
            $thumb_image = '';
    
            if (geodir_is_page('detail')) {
    
                $post_images = geodir_get_images($post->ID, 'thumbnail');
                if (!empty($post_images)) {
                    foreach ($post_images as $image) {
                        $thumb_image .= '<a>src) . '">';
                        $thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
                        $thumb_image .= '</a>';
                    }
                }
    
            } elseif (geodir_is_page('preview')) {
    
                if (isset($post->post_images))
                    {$post->post_images = trim($post->post_images, ",");}
    
                if (isset($post->post_images) && !empty($post->post_images))
                    {$post_images = explode(",", $post->post_images);}
    
                if (!empty($post_images)) {
                    foreach ($post_images as $image) {
                        if ($image != '') {
                            $thumb_image .= '<a href="' . esc_url($image) . '">';
                            $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
                            $thumb_image .= '</a>';
                        }
                    }
                }
    
            }
    
            ?>
            <?php if (geodir_is_page('detail') || geodir_is_page('preview')) { ?>
                <div id="geodir-post-gallery" class="clearfix"><?php echo $thumb_image; ?></div>
            <?php }
        }
    }
    
    add_action('geodir_detail_sidebar_inside', 'sd_img_gallery_output', 1);
    
    // add recurring dates to sidebar if events installed
    if(function_exists('geodir_event_show_shedule_date')){
        add_action('geodir_detail_sidebar_inside', 'geodir_event_show_shedule_date', '1.5');
    }
    
    /**
     * Output the details page map HTML.
     *
     * @since 1.0.0
     */
    function sd_map_in_detail_page_sidebar()
    {
    
        $excluded_tabs = get_option('geodir_detail_page_tabs_excluded',true);
        if(is_array($excluded_tabs) && in_array('post_map',$excluded_tabs)){
            global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
    
            $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
            $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
            $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
    
            if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
                $post = geodir_get_post_info($request_post_id);
                setup_postdata($post);
            }
    
            if(!isset($post->post_latitude) || $post->post_latitude==''){
                return '';// if not address, bail.
            }
            $geodir_post_detail_fields = geodir_show_listing_info('detail');
    
            if (geodir_is_page('detail')) {
    
                $map_args = array();
                $map_args['map_canvas_name'] = 'detail_page_map_canvas';
                $map_args['width'] = '300';
                $map_args['height'] = '400';
                if ($post->post_mapzoom) {
                    $map_args['zoom'] = '' . $post->post_mapzoom . '';
                }
                $map_args['autozoom'] = false;
                $map_args['child_collapse'] = '0';
                $map_args['enable_cat_filters'] = false;
                $map_args['enable_text_search'] = false;
                $map_args['enable_post_type_filters'] = false;
                $map_args['enable_location_filters'] = false;
                $map_args['enable_jason_on_load'] = true;
                $map_args['enable_map_direction'] = true;
                $map_args['map_class_name'] = 'geodir-map-detail-page';
    
            } elseif (geodir_is_page('preview')) {
    
                global $map_jason;
                $map_jason[] = $post->marker_json;
    
                $address_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
                $address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
                $mapview = isset($post->post_mapview) ? $post->post_mapview : '';
                $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
                if (!$mapzoom) {
                    $mapzoom = 12;
                }
    
                $map_args = array();
                $map_args['map_canvas_name'] = 'preview_map_canvas';
                $map_args['width'] = '300';
                $map_args['height'] = '400';
                $map_args['child_collapse'] = '0';
                $map_args['maptype'] = $mapview;
                $map_args['autozoom'] = false;
                $map_args['zoom'] = "$mapzoom";
                $map_args['latitude'] = $address_latitude;
                $map_args['longitude'] = $address_longitude;
                $map_args['enable_cat_filters'] = false;
                $map_args['enable_text_search'] = false;
                $map_args['enable_post_type_filters'] = false;
                $map_args['enable_location_filters'] = false;
                $map_args['enable_jason_on_load'] = true;
                $map_args['enable_map_direction'] = true;
                $map_args['map_class_name'] = 'geodir-map-preview-page';
    
            }
            if (geodir_is_page('detail') || geodir_is_page('preview')) { ?>
                <div class="sd-map-in-sidebar-detail"><?php geodir_draw_map($map_args); ?>
    
                </div>
            <?php }
        }
    }
    
    add_action('geodir_detail_sidebar_inside', 'sd_map_in_detail_page_sidebar', 2);
    
    /**
     * Fire the signup functions from GeoDirectory so the SD login form works.
     *
     * @since 1.0.0
     */
    function sd_header_login_handler()
    {
        if (!geodir_is_page('login') && isset($_REQUEST['log'])) {
            geodir_user_signup();
        }
    }
    
    add_action('init', 'sd_header_login_handler');
    
    // add paging html to top of listings
    function sd_before_listing_pagination()
    {
        if (sd_is_non_location_cpt()) {
            return;
        }
        add_action('geodir_before_listing', 'geodir_pagination', 100);
    }
    
    add_action('wp', 'sd_before_listing_pagination');
    
    /**
     * Add fav html to listing page image.
     *
     * @since 1.0.0
     *
    *@param object $post The post object.
     */
    function sd_listing_img_fav($post)
    {
        if (isset($post->ID)) {
            geodir_favourite_html($post->post_author, $post->ID);
        }
    }
    
    add_action('geodir_after_badge_on_image', 'sd_listing_img_fav', 10, 1);
    
    // remove pinpoint and normal fav html from listings
    remove_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1);
    remove_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1);
    
    // hide toolbar in frontend
    // add_filter('show_admin_bar', '__return_false'); // not allowed if submitting to wp.org
    
    // remove core term description from listins pages
    
    if (!defined('GEODIRLOCATION_VERSION')) {
    	remove_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
    	add_action('geodir_listings_content', 'geodir_action_listings_description', 2);
    
    }else{
        remove_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
    	remove_action('wp_print_scripts', 'geodir_location_remove_action_listings_description', 100);
    }
    
    // CPT description
    if (defined('GEODIR_CP_TEXTDOMAIN')) {
    remove_action('geodir_listings_page_description', 'geodir_cpt_pt_desc', 10);
    add_action('geodir_listings_content', 'geodir_cpt_pt_desc', 2);
    }
    
    if (defined('GEODIRLOCATION_VERSION')) {
        // remove location manager term description from listings pages
        remove_action('wp_print_scripts', 'geodir_location_remove_action_listings_description', 100);
        add_action('geodir_listings_content', 'geodir_location_action_listings_description', 2);
    }
    
    // remove claim link from sidebar as we have it in top bar
    remove_action('geodir_after_edit_post_link', 'geodir_display_post_claim_link', 2);
    
    /*
     * Move listings page title into the main wrapper content.
     */
    // move page titles
    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
    add_action('geodir_listings_content', 'geodir_action_listings_title', 1);
    // search page tile
    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
    add_action('geodir_search_content', 'geodir_action_search_page_title', 1);
    // author page tile
    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
    add_action('geodir_author_content', 'geodir_action_author_page_title', 1);
    
    /**
     * Return the font awesome search icon HTML.
     *
     * Replace advanced search button with fontawesome cog.
     *
     * @since 1.0.0
     * @return string The font awesome cog sign.
     */
    function sd_gd_adv_search_s_btn_value()
    {
        return "&#xf002;";
    }
    
    add_filter('geodir_search_default_search_button_text', 'sd_gd_adv_search_s_btn_value', 10);
    
    function sd_theme_deactivation($newname, $newtheme) {
        // undo set the details page to use list and not tabs
        update_option('geodir_disable_tabs', '0');
        // undo disable some details page tabs that we show in the sidebar
        update_option('geodir_detail_page_tabs_excluded', array());
        // undo Set the installed flag
        update_option('sd-installed', false);
    
    }
    add_action("switch_theme", "sd_theme_deactivation", 10 , 2);
    
    //remove send to friend/enquiry from details page
    add_filter("geodir_show_geodir_email", '__return_false');
    remove_action('geodir_after_detail_page_more_info', 'geodir_payment_sidebar_show_send_to_friend', 11);
    
    function sd_detail_display_notices() {
        if (geodir_is_page('detail')) {
            if (isset($_GET['geodir_claim_request']) && $_GET['geodir_claim_request'] == 'success') {
                ?>
                <div class="alert alert-success" style="text-align: center">
                    <?php echo CLAIM_LISTING_SUCCESS; ?>
                </div>
                <?php
            }
    
            if (isset($_GET['send_inquiry']) && $_GET['send_inquiry'] == 'success') {
                ?>
                <div class="alert alert-success" style="text-align: center">
                    <?php echo SEND_INQUIRY_SUCCESS; ?>
                </div>
                <?php
            }
    
            if (isset($_GET['sendtofrnd']) && $_GET['sendtofrnd'] == 'success') {
                ?>
                <div class="alert alert-success" style="text-align: center">
                    <?php echo SEND_FRIEND_SUCCESS; ?>
                </div>
                <?php
            }
        }
    }
    add_action('sd-detail-details-before', 'sd_detail_display_notices');
    
    /**
     * Output the header featured area image HTML.
     *
     * Add featured banner and listing details above wrapper.
     *
     * @since 1.0.0
     *
    *@param string $page The GeoDirectory page being called.
     */
    function sup_add_feat_img_head($page)
    {
        if ($page == 'details-page') {
    
            global $preview, $post;
            $default_img_url = SD_DEFAULT_FEATURED_IMAGE;
            $full_image_url = '';
            if ($preview) {
                geodir_action_geodir_set_preview_post();//Set the $post value if previewing a post.
                $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);
                }
                $full_image_url = (isset($post_images[0])) ? $post_images[0] : $default_img_url;
            } else {
                if (has_post_thumbnail()) {
                    $full_image_urls = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                    $full_image_url = $full_image_urls[0];
                } else {
                    if (isset($post->default_category) && $post->default_category) {
                        $default_cat = $post->default_category;
                    } else {
                        $default_cat = geodir_get_post_meta($post->ID, 'default_category', true);
                    }
    
                    if ($default_catimg = geodir_get_default_catimage($default_cat, $post->post_type)) {
                        $full_image_url = $default_catimg['src'];
                    }
    
                    if (empty($full_image_url)) {
                        $full_image_url = $default_img_url;
                    }
    
                }
            }
            ?>
            <div class="featured-area">
    
                <div class="featured-img" style="background-image: url('<?php echo esc_url($full_image_url); ?>');"></div>
    
                <?php if ($preview) {
                    echo geodir_action_geodir_preview_code();
                }else{
                do_action('sd_details_featured_area_text');
                }
    
                 ?>
            </div>
            <?php
            $user_id = get_current_user_id();
            $post_avgratings = geodir_get_post_rating($post->ID);
            $post_ratings = geodir_get_rating_stars($post_avgratings, $post->ID);
            ob_start();
            if (!$preview) {
                geodir_comments_number($post->rating_count);
            } else {
    
            }
            $n_comments = ob_get_clean();
            if (!$preview) {
                $author_id = $post->post_author;
                $author_name = get_the_author_meta('display_name', $author_id);
                $entry_author = get_avatar(get_the_author_meta('email', $author_id), 100);
                $author_link = get_author_posts_url($author_id);
                $post_type = $post->post_type;
                $post_tax = $post_type . "category";
                $post_cats = $post->{$post_tax};
            } else {
                $author_name = get_the_author_meta('display_name', $user_id);
                $entry_author = get_avatar(get_the_author_meta('email', $user_id), 100);
                $author_link = get_author_posts_url($user_id);
                $post_type = $post->listing_type;
                $post_tax = $post_type . "category";
                $post_cats = isset($post->post_category) ? $post->post_category[$post_tax] : $post->{$post_tax};
            }
    
            $postlink = get_permalink(geodir_add_listing_page_id());
            $editlink = geodir_getlink($postlink, array('pid' => $post->ID), false);
    
            $extra_class = apply_filters('sd_detail_details_extra_class', "");
    
            if (is_array($post_cats)) {
                $post_cats = implode(',', $post_cats);
            }
    
            $cats_arr = array_filter(explode(",", $post_cats));
            $cat_icons = geodir_get_term_icon();
            
            $post_id = $post->ID;
            
            // WPML
            $duplicate_of = geodir_is_wpml() ? get_post_meta((int)$post_id, '_icl_lang_duplicate_of', true) : NULL;
            // WPML
            ?>
            <?php do_action('sd-detail-details-before'); ?>
            <div class="sd-detail-details  <?php echo $extra_class; ?>">
            <div class="container">
                <div class="sd-detail-author">
                    <?php
                    $is_owned = false;
                    if (!$preview && function_exists('geodir_load_translation_geodirclaim')) {
                        $geodir_post_type = get_option('geodir_post_types_claim_listing', array());
                        
                        if (in_array($post_type, $geodir_post_type)) {
                            $is_owned = !$duplicate_of ? (int)geodir_get_post_meta($post_id, 'claimed', true) : (int)geodir_get_post_meta($duplicate_of, 'claimed', true);
                            
                            if ($is_owned) {
                                ?>
                                <span class="fa fa-stack sd-verified-badge" title="<?php _e('Verified Owner', 'supreme-directory'); ?>">
                                    <i class="fa fa-circle fa-inverse"></i>
                                    <i class="fa fa-check-circle"></i>
                                </span>
                                <?php
                            } else {
                                $author_link = '#';
                                $author_name = __('Claim Me', 'supreme-directory');
                                $entry_author = '<img height="100" width="100" />';
                            }
                        }
                    }
                    
                    $author_name = apply_filters('sd_detail_author_name', $author_name);
                    $entry_author = apply_filters('sd_detail_entry_author', $entry_author);
                    $author_link = apply_filters('sd_detail_author_link', $author_link);
    
                    printf('<div class="author-avatar"><a href="%s">%s</a></div>', esc_url($author_link), $entry_author);
    
                    if (!defined('GEODIRCLAIM_VERSION') || $is_owned == '1') {
                        printf('<div class="author-link"><span class="vcard author author_name"><span class="fn"><a href="%s">%s</a></span></span></div>', esc_url($author_link), esc_attr($author_name));
                        do_action('sd_detail_author_extra', $post, $author_link, $author_name);
                    } else {
                        do_action('sd_detail_default_author', $post, $author_link, $author_name);
                    }
    
                    if (is_user_logged_in() && geodir_listing_belong_to_current_user()) {
                    global $preview;
                    if( $preview ){
                    $editlink = '#';
                    }
                        ?>
                        <a>" class="supreme-btn supreme-btn-small supreme-edit-btn"><i
                                class="fa fa-edit"></i> <?php echo __('Edit', 'supreme-directory'); ?></a>
                    <?php }
    
                    if (function_exists('geodir_load_translation_geodirclaim')) {
                        $geodir_post_type = array();
                        if (get_option('geodir_post_types_claim_listing')) {
                            $geodir_post_type = get_option('geodir_post_types_claim_listing');
                        }
        
                        $posttype = (isset($post->post_type)) ? $post->post_type : '';
                        
                        if (in_array($posttype, $geodir_post_type) && !$preview) {
                            $is_owned = !$duplicate_of ? (int)geodir_get_post_meta($post_id, 'claimed', true) : (int)geodir_get_post_meta($duplicate_of, 'claimed', true);
            
                            if (get_option('geodir_claim_enable') == 'yes' && !$is_owned ) {
                                if ($duplicate_of) {
                                    $current_url = get_permalink($duplicate_of);
                                    $current_url = add_query_arg(array('gd_go' => 'claim'), $current_url);
                                    
                                    if (!is_user_logged_in()) {
                                        $current_url = geodir_login_url(array('redirect_to' => urlencode_deep($current_url)));
                                        $current_url = apply_filters('geodir_claim_login_to_claim_url', $current_url, $duplicate_of);
                                    }
                                        
                                    echo '<a href="' . esc_url($current_url) . '"><i class="fa fa-question-circle"></i> ' . __('Claim', 'supreme-directory') . '</a>';
                                } else {
                                    if (is_user_logged_in()) {
                                        echo '<div class="geodir-company_info">';
                                        echo '<div class="geodir_display_claim_popup_forms"></div>';
                                        echo '<a href="void(0);"><i class="fa fa-question-circle"></i> ' . __('Claim', 'supreme-directory') . '</a>';
                                        echo '</div>';
                                        echo '<input type="hidden" name="geodir_claim_popup_post_id" value="' . $post->ID . '" />';
                                        if (!empty($_REQUEST['gd_go']) && $_REQUEST['gd_go'] == 'claim' && !isset($_REQUEST['geodir_claim_request'])) {
                                            echo '<script type="text/javascript">jQuery(function(){jQuery(".supreme-btn.geodir_claim_enable").trigger("click");});</script>';
                                        }
                                    } else {
                                        $current_url = remove_query_arg(array('gd_go'), geodir_curPageURL());
                                        $current_url = add_query_arg(array('gd_go' => 'claim'), $current_url);
                                        $login_to_claim_url = geodir_login_url(array('redirect_to' => urlencode_deep($current_url)));
                                        $login_to_claim_url = apply_filters('geodir_claim_login_to_claim_url', $login_to_claim_url, $post->ID);
                                        
                                        echo '<a href="' . esc_url($login_to_claim_url) . '"><i class="fa fa-question-circle"></i> ' . __('Claim', 'supreme-directory') . '</a>';
    
                                    }
                                }
                            }
                        }
                    }
                    ?>
                </div>
                <!-- sd-detail-suthor end -->
                <div class="sd-detail-info">
                    <?php
                    $title_extra_class = apply_filters('sd_detail_title_extra_class', "");
                    echo '<h1 class="sd-entry-title '.$title_extra_class.'">' .  stripslashes(get_the_title());
                    ?>
                    <?php
                    echo '</h1>';
                    $sd_address = '<div class="sd-address">';
                    if (isset($post->post_city) && $post->post_city) {
                        $sd_address .= apply_filters('sd_detail_city_name', $post->post_city, $post);
                    }
                    if (isset($post->post_region) && $post->post_region) {
                        $sd_address .= ', ' . apply_filters('sd_detail_region_name', $post->post_region, $post);
                    }
                    if (isset($post->post_country) && $post->post_country) {
                        $sd_address .= ', ' . apply_filters('sd_detail_country_name', __($post->post_country, 'geodirectory'), $post);
                    }
                    $sd_address .= '</div>';
    
                    echo apply_filters('sd_details_output_address',$sd_address);
    
                    $sd_raitings = '<div class="sd-ratings">' . $post_ratings . ' <a href="' . get_comments_link() . '">' . $n_comments . '</a></div>';
                    echo apply_filters('sd_details_output_ratings',$sd_raitings);
                    $sd_social = '<div class="sd-contacts">';
                    if (isset($post->geodir_website) && $post->geodir_website) {
                        $sd_social .= '<a rel="nofollow" target="_blank">geodir_website) . '"><i class="fa fa-external-link-square"></i></a>';
                    }
                    if (isset($post->geodir_facebook) && $post->geodir_facebook) {
                       $sd_social .='<a rel="nofollow" target="_blank">geodir_facebook) . '"><i class="fa fa-facebook-official"></i></a>';
                    }
                    if (isset($post->geodir_twitter) && $post->geodir_twitter) {
                        $sd_social .='<a rel="nofollow" target="_blank">geodir_twitter) . '"><i class="fa fa-twitter-square"></i></a>';
                    }
                    if (isset($post->geodir_contact) && $post->geodir_contact) {
                        $sd_social .='<a>geodir_contact) . '"><i class="fa fa-phone-square"></i>&nbsp;:&nbsp;' . esc_attr($post->geodir_contact) . '</a>';
                    }
                    $sd_social .= '</div>';
    
                    echo apply_filters('sd_details_output_social',$sd_social);
    
                    do_action('sd_detail_before_cat_links');
    
                    $cat_links = '<div class="sd-detail-cat-links"><ul>';
                    foreach ($cats_arr as $cat) {
                        $term_arr = get_term($cat, $post_tax);
                        $term_icon = isset($cat_icons[$cat]) ? $cat_icons[$cat] : '';
                        $term_url = get_term_link(intval($cat), $post_tax);
                        $cat_links .=  '<li><a href="' . esc_url($term_url) . '"><img src="' . esc_url($term_icon) . '" />';
                        $cat_links .= '<span class="cat-link">' . esc_attr($term_arr->name) . '</span>';
                        $cat_links .= '</a></li>';
                    }
                    $cat_links .= '</ul></div> <!-- sd-detail-cat-links end --> </div> <!-- sd-detail-info end -->';
                    echo apply_filters('sd_details_output_cat_links',$cat_links);
                    
                    echo '<div class="sd-detail-cta">';?>
                        <a href="#reservation">RESERVATION</a>
    
                    <?php
    /*
    if (is_user_logged_in()){
            
         $cu = wp_get_current_user();            
         echo '<p id="usuario" style="visibility: hidden">'. $cu->user_firstname.' '.$cu->user_lastname.'</p>';
         echo '<p id="correo" style="visibility: hidden">'. $cu->user_email.'</p>';
            
    }
    */
                    $send_buttons = '<div class="geodir_more_info geodir-company_info geodir_email" style="padding: 0;border: none">';
    
                    if (!$preview) {
                        $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" />
                        <div class="geodir_display_popup_forms"></div>';
    	                $send_buttons .= $html;
                    }
    
                    $send_buttons .= '<span style="" class="geodir-i-email">';
                    $send_buttons .= '<i class="fa fa-envelope"></i>';
    			    if (isset($post->geodir_email) && $post->geodir_email) {
    				    $send_buttons .= '<a href="void(0);">'.SEND_INQUIRY.'</a> | ';
    			    }
                    $send_buttons .= '<a href="void(0);">'.SEND_TO_FRIEND.'</a></span>';
                    $send_buttons .= '</div>';
    
                    echo apply_filters('sd_details_output_send_buttons',$send_buttons);
    
    				ob_start();
                    geodir_favourite_html($post->post_author, $post->ID);
                    $fav_html = ob_get_clean();
                    echo apply_filters('sd_details_output_fav',$fav_html);
    
    				ob_start();
                    ?>
                    <ul class="sd-cta-favsandshare">
                        <?php if (!$preview) { ?>
                            <li><a rel="nofollow" target="_blank">"
                                   href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>"><i
                                        class="fa fa-facebook"></i></a></li>
                            <li><a rel="nofollow" target="_blank">"
                                   href="http://twitter.com/share?text=<?php echo urlencode(get_the_title()); ?>&url=<?php echo urlencode(get_the_permalink()); ?>"><i
                                        class="fa fa-twitter"></i></a></li>
                            <li><a rel="nofollow" target="_blank">"
                                   href="https://plus.google.com/share?url=<?php echo urlencode(get_the_permalink()); ?>"><i
                                        class="fa fa-google-plus"></i></a></li>
                        <?php } else { ?>
                            <li><a rel="nofollow" target="_blank">"
                                   href=""><i class="fa fa-facebook"></i></a></li>
                            <li><a rel="nofollow" target="_blank">"
                                   href=""><i class="fa fa-twitter"></i></a></li>
                            <li><a rel="nofollow" target="_blank">"
                                   href=""><i class="fa fa-google-plus"></i></a></li>
                        <?php } ?>
                    </ul>
                    <?php
    
                    $share_html = ob_get_clean();
                    echo apply_filters('sd_details_output_share_links',$share_html);
                    echo '</div><!-- sd-detail-cta end -->'; ?>
    
                </div>
                <!-- container end -->
            </div><!-- sd-detail-details end -->
    
        <?php } elseif ($page == 'home-page') {
    
            if (function_exists('geodir_get_location_seo')) {
                $seo = geodir_get_location_seo();
                if (isset($seo->seo_image_tagline) && $seo->seo_image_tagline) {
                    $sub_title = __($seo->seo_image_tagline, 'geodirlocation');
                }
                if (isset($seo->seo_image) && $seo->seo_image) {
                    $full_image_url = wp_get_attachment_image_src($seo->seo_image, 'full');
                }
            }
    
            if (isset($full_image_url)) {
    
            } elseif (has_post_thumbnail()) {
                $full_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            } else {
                $full_image_url[0] = SD_DEFAULT_FEATURED_IMAGE;
            }
    
            if (!isset($sub_title) && get_post_meta(get_the_ID(), 'subtitle', true)) {
                $sub_title = get_post_meta(get_the_ID(), 'subtitle', true);
            }
    
            $full_image_url = apply_filters('sd_featured_image_url', esc_url($full_image_url[0]));
    
            ?>
            <div class="featured-area">
                <div class="featured-img" style="background-image: url('<?php echo $full_image_url; ?>');">
                </div>
                <div class="header-wrap">
                <?php do_action('sd_homepage_content');?>
    
                </div>
            </div>
        <?php
        }
    
    }
    
    function sd_gd_current_location_name(){
    
    	/*
    	 * If location manager not installed then display the default location.
    	 */
    	if (!function_exists('geodir_current_loc_shortcode')) {
    	    global $gd_session;
    	    $output = geodir_get_default_location();
    
    	    $output = $output->city;
    
    	    if (($gd_session->get('my_location') || ($gd_session->get('user_lat') && $gd_session->get('user_lon')))) {
    	        $output = __('Near Me', 'supreme-directory');
    	    }
    
    	}else{
    		$output = do_shortcode('[gd_current_location_name]');
    	}
    
    	return $output;
    }
    
    function sd_homepage_featured_content() {
        if (is_singular() && geodir_is_page('location') && $location = sd_gd_current_location_name() ) { ?>
            <h1 class="entry-title"><?php echo esc_attr(__($location, 'geodirectory')); ?></h1>
        <?php } else { ?>
            <h1 class="entry-title"><?php the_title(); ?></h1>
        <?php }
    
        $sub_title = get_post_meta(get_the_ID(), 'subtitle', true);
    
        if (geodir_is_page('location') && defined('GEODIRLOCATION_VERSION')) {
            $loc = geodir_get_current_location_terms();
            $location_type = geodir_what_is_current_location();
            $country_slug = '';
            $region_slug = '';
            if ($location_type == 'city') {
                $slug = $loc['gd_city'];
                $region_slug = isset($loc['gd_region']) ? $loc['gd_region'] : '';
                $country_slug = isset($loc['gd_country']) ? $loc['gd_country'] : '';
            } else if ($location_type == 'region') {
                $slug = $loc['gd_region'];
                $country_slug = isset($loc['gd_country']) ? $loc['gd_country'] : '';
            } elseif($location_type == 'country') {
                $slug = $loc['gd_country'];
                $country_slug = isset($loc['gd_country']) ? $loc['gd_country'] : '';
            }
            else {
                $slug = '';
            }
            $seo = geodir_location_seo_by_slug($slug, $location_type, $country_slug, $region_slug);
            $tagline = (isset($seo->seo_image_tagline)) ? __($seo->seo_image_tagline, 'geodirlocation') : '';
            if ($tagline) {
                $sub_title = stripslashes($tagline);
            }
    
        }
        if (isset($sub_title)) {
            echo '<div class="entry-subtitle">' . $sub_title . '</div>';
        }
    
        sd_search_form_shortcode();
        echo do_shortcode('[gd_popular_post_category category_limit=5 category_restrict=1]');
        
        echo '<div class="home-more" id="sd-home-scroll"><a href="#sd-home-scroll"><i class="fa fa-chevron-down"></i></a></div>';
    }
    add_action('sd_homepage_content','sd_homepage_featured_content');
    
    function sd_add_gd_home_class($classes) {
        if (geodir_is_page('home') || geodir_is_page('location')) {
            $classes[] = 'sd-homepage';
        }
        return $classes;
    }
    add_filter( 'body_class', 'sd_add_gd_home_class' );
    
    /**
     * This function removes date section added by event manager in sidebar.
     *
     * @since 1.0.3
     */
    function sd_geodir_event_date_remove($template) {
    
        if(geodir_get_current_posttype() == 'gd_event' && defined('GDEVENTS_VERSION')){
    
            remove_filter('geodir_detail_page_sidebar_content', 'geodir_event_detail_page_sitebar_content', 2);
    
        }
    
        return $template;
    }
    add_filter( 'template_include', 'sd_geodir_event_date_remove',0);
    
    /**
     * This function fixes scroll bar issue by resizing window.
     *
     * In safari scroll bar are not working properly when the user click back button.
     * This function fixes that issue by resizing window.
     * Refer this thread https://wpgeodirectory.com/support/topic/possible-bug/
     *
     * @since 1.0.3
     */
    function sd_safari_back_button_scroll_fix() {
        if (geodir_is_page('listing') || geodir_is_page('search')) {
        ?>
        <script type="text/javascript">
            jQuery( document ).ready(function() {
                var is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
                var is_safari = navigator.userAgent.indexOf("Safari") > -1 && !is_chrome;
                if (is_safari) {
                    window.onpageshow = function(event) {
                        if (event.persisted) {
                            jQuery(window).trigger('resize');
                        }
                    };
                }
            });
    
        </script>
        <?php
        }
    }
    add_filter('wp_footer', 'sd_safari_back_button_scroll_fix');
    
    /**
     * Add the search and category widgets to the GD home page feature area.
     *
     * @since 1.0.4
     */
    function sd_feature_area_gd(){
    
        if (is_front_page() && !geodir_is_page('home')) {
            sd_search_form_shortcode();
            echo do_shortcode('[gd_popular_post_category category_limit=5]');
            echo '<div class="home-more"  id="sd-home-scroll" ><a href="#sd-home-scroll"><i class="fa fa-chevron-down"></i></a></div>';
        }
    }
    add_action('sd_feature_area','sd_feature_area_gd',15);
    
    // remove original featured area
    function sd_remove_sd_feature_area(){
    remove_action('sd_feature_area','sd_feature_area',15);
    }
    add_action('get_template_part_content','sd_remove_sd_feature_area');
    
    /**
     * Change the author page content if GeoDirectory Installed
     *
     * @since 1.0.82
     * @param Object $author The author object.
     */
    function sd_gd_author_content_output($author){
    
    	// user listings
        echo "<h3>".__("Listings", "supreme-directory")."</h3>";
        geodir_user_show_listings($author->ID,'link');
    
    	// user favs
    	$fav_count = geodir_user_favourite_listing_count($author->ID);
    	if(!empty($fav_count )){
    	    echo "<h3>".__("Favorites", "supreme-directory")."</h3>";
    	    geodir_user_show_favourites($author->ID,'link');
    	}
    
    }
    
    add_action('sd_author_content','sd_gd_author_content_output',10,1);
    
    /**
     * Fires after theme setup to be able to remove actions set prior.
     *
     * @since 1.0.82
     */
    function sd_gd_remove_theme_functions(){
    	remove_action('sd_author_content','sd_author_content_output',10);
    }
    add_action('after_setup_theme','sd_gd_remove_theme_functions');
    
    add_action('geodir_before_detail_page_more_info','sd_tags_content');
    function sd_tags_content()
    {
        global $preview, $post;?>
        <?php
        $taxonomies = array();
    
        $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
    
        if ($preview && !$is_backend_preview) {
            $post_type = $post->listing_type;
            $post_taxonomy = $post_type . 'category';
            $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
        } else {
            $post_type = $post->post_type;
        }
    
        $post_type_info = get_post_type_object($post_type);
        $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
    
        if (!empty($post->post_tags)) {
    
            if (taxonomy_exists($post_type . '_tags')):
                $links = array();
                $terms = array();
                // to limit post tags
                $post_tags = trim($post->post_tags, ",");
                $post_id = isset($post->ID) ? $post->ID : '';
    
                $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
    
                $post->post_tags = $post_tags;
                $post_tags = explode(",", trim($post->post_tags, ","));
    
                foreach ($post_tags as $post_term) {
    
                    // fix slug creation order for tags & location
                    $post_term = trim($post_term);
    
                    $priority_location = false;
                    if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
                        $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
                    } else {
                        $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
                        $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
                        $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
                        $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
                        if ($post_country && !$match_country) {
                            $match_country = sanitize_title($post_term) == sanitize_title(__($post_country, 'geodirectory')) ? true : false;
                        }
                        $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
                        $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
                        if ($match_country || $match_region || $match_city) {
                            $priority_location = true;
                            $term = get_term_by('name', $post_term, $post_type . '_tags');
                        } else {
                            $insert_term = wp_insert_term($post_term, $post_type . '_tags');
                            $term = get_term_by('name', $post_term, $post_type . '_tags');
                        }
                    }
    
                    if (!is_wp_error($term) && is_object($term)) {
    
                        // fix tag link on detail page
                        if ($priority_location) {
    
                            $tag_link = "<a href=''>$post_term</a>";
    
                            $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
                            $links[] = $tag_link;
                        } else {
                            $tag_link = "<a>term_id, $term->taxonomy)) . "'>$term->name</a>";
                            /** This action is documented in geodirectory-template_actions.php */
                            $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
                            $links[] = $tag_link;
                        }
                        $terms[] = $term;
                    }
                    //
                }
                if (!isset($listing_label)) {
                    $listing_label = '';
                }
                $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
            endif;
    
        }
    
        $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
    
        if (isset($taxonomies[$post_type . '_tags'])) {
            echo '<div class="geodir_more_info">';
            echo '<span class="">' . $taxonomies[$post_type . '_tags'] . '</span>';
            echo '</div>';
        }
        ?>
        <?php
    }
    
    function sd_is_non_location_cpt() {
        if (geodir_is_page('listing') || geodir_is_page('search')) {
            $post_types = get_option( 'geodir_cpt_disable_location' );
            $cur_post_type = geodir_get_current_posttype();
            if (is_array($post_types) && in_array($cur_post_type, $post_types)) {
                return true;
            }
        }
        return false;
    }
    in reply to: Categories drop down #387072

    Paolo
    Site Admin
    Post count: 31211

    Yes,

    please see: https://wpgeodirectory.com/docs/gd-search/

    You’ll need to hide the search for field with css.

    Thanks

    in reply to: Featured Image on Detail Page #387071

    Paolo
    Site Admin
    Post count: 31211

    What theme are you using? If you provide a link and admin credentials we’ll have a look.

    Thanks

    in reply to: location #387070

    Paolo
    Site Admin
    Post count: 31211

    You are using the wrong widget maybe? You need the listing widget not the map widget…

    Let us know if that was the problem.

    Thanks

    in reply to: Hard to die PHP Warning #387068

    Paolo
    Site Admin
    Post count: 31211

    Please provide a link and admin credentials and we will check.

    Thanks

    in reply to: city other #387067

    Paolo
    Site Admin
    Post count: 31211

    In MultiLocations, you enabled both the default region and default city.

    That means that you can only submit listings in the default city…

    Thanks

    in reply to: Advanced search not working for CPT #387057

    Paolo
    Site Admin
    Post count: 31211

    How did you do search and replace on the database?

    If you didn’t use something like better search and replace plugin, you broke serialized options.

    Let us know,

Viewing 15 posts - 4,186 through 4,200 (of 27,715 total)
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount