Hide Map for package

This topic contains 13 replies, has 4 voices, and was last updated by  Kiran 5 years, 10 months ago.

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #466850

    Javier Vasquez
    Expired Member
    Post count: 100

    Hi,

    I read this post: https://wpgeodirectory.com/support/topic/hide-address-map-based-on-package-type/

    But this is for V1, could you update the CSS for V2?

    The issue is to hide the map only for an specific package
    Thanks!

    #466947

    Kor
    Moderator
    Post count: 16516

    Hi Javier,

    Thanks for your post. Could you share the URL of the site in question so that I could provide you the custom CSS code to achieve this?

    Thanks!

    #466984

    Javier Vasquez
    Expired Member
    Post count: 100
    This reply has been marked as private.
    #467103

    Kor
    Moderator
    Post count: 16516
    This reply has been marked as private.
    #467153

    Javier Vasquez
    Expired Member
    Post count: 100
    This reply has been marked as private.
    #467283

    Javier Vasquez
    Expired Member
    Post count: 100
    This reply has been marked as private.
    #467320

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #467352

    Javier Vasquez
    Expired Member
    Post count: 100
    This reply has been marked as private.
    #467448

    Kor
    Moderator
    Post count: 16516

    Hi Javier,

    Thanks for your reply. I’ve checked the CSS structure of the listing page and unfortunately, what you needed isn’t possible out of the box. But I’ll forward this to a developer for a second look.

    Thanks!

    #467455

    Javier Vasquez
    Expired Member
    Post count: 100
    This reply has been marked as private.
    #467526

    Kiran
    Moderator
    Post count: 7069

    Hello Javier,

    In next release of Pricing Manager there will be a body css class ‘gd-pkg-id-x’ (where x = package id) on detail page.

    You can use following snippet to hide map & address for particular package id.

    
    
    /**
     * Hide address for particular post package id.
     */
    function gd_snippet_190207_cf_output_address( $html, $location, $cf, $output ) {
    	global $gd_post;
    
    	if ( empty( $gd_post ) ) {
    		return $html;
    	}
    
    	if ( ! empty( $gd_post->package_id ) ) {
    		$package_id = (int) $gd_post->package_id;
    
    		if ( $package_id === 2 ) { // Hide address for package id: 2
    			$html = '<!--hidden-->';
    		}
    	}
    
    	return $html;
    }
    add_filter( 'geodir_custom_field_output_address_var_address', 'gd_snippet_190207_cf_output_address', 20, 4 );
    
    /**
     *	Hide detail map for particular post package id.
     */
    function gd_snippet_190207_check_display_map( $display, $params ) {
    	global $gd_post;
    
    	if ( $display && ! empty( $params['posts'] ) && $params['posts'] == $gd_post->ID && ! empty( $gd_post ) && isset( $gd_post->package_id ) ) {
    		$package_id = (int) $gd_post->package_id;
    
    		if ( ( $package_id === 2 ) && ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) ) {// Hide map for package id: 2
    			$display = false;
    		}
    	}
    
    	return $display;
    }
    add_filter( 'geodir_check_display_map', 'gd_snippet_190207_check_display_map', 20, 2 );

    Thanks,
    Kiran

    #467654

    Javier Vasquez
    Expired Member
    Post count: 100

    Thanks! Let me try it

    #467665

    Javier Vasquez
    Expired Member
    Post count: 100
    This reply has been marked as private.
    #467773

    Kiran
    Moderator
    Post count: 7069

    Hello,

    In next version of Pricing Manager there will be package id also added to body class.

    For now you can use following code snippet.

    
    
    function gd_snippet_190208_body_class( $classes ) {
        global $gd_post;
    
        // Add post package id to body class.
    	if ( ! empty( $gd_post ) && isset( $gd_post->package_id ) && ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) ) {
    		$classes[] = 'gd-pkg-id-' . $gd_post->package_id;
    	}
    
        return $classes;
    }
    add_filter( 'body_class', 'gd_snippet_190208_body_class', 10, 1 );

    Once you add this snippet. You can use .gd-pkg-id-2 css class to hide div.
    Ex:

    
    
    .gd-pkg-id-2 .widget.geodir-post-directions {
    display: none;
    }

    Kiran

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount