Hide Map for package
This topic contains 13 replies, has 4 voices, and was last updated by  Kiran 6 years, 8 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: snippet
- 
		AuthorPosts
- 
		
			
				
February 4, 2019 at 4:42 am #466850Hi, 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!February 4, 2019 at 2:09 pm #466947Hi 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! February 4, 2019 at 6:09 pm #466984This reply has been marked as private.February 5, 2019 at 3:40 am #467103This reply has been marked as private.February 5, 2019 at 11:39 am #467153This reply has been marked as private.February 5, 2019 at 8:03 pm #467283This reply has been marked as private.February 5, 2019 at 11:00 pm #467320This reply has been marked as private.February 6, 2019 at 2:49 am #467352This reply has been marked as private.February 6, 2019 at 5:53 pm #467448Hi 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! February 6, 2019 at 6:07 pm #467455This reply has been marked as private.February 7, 2019 at 5:00 am #467526Hello 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, 
 KiranFebruary 7, 2019 at 6:57 pm #467654Thanks! Let me try it February 7, 2019 at 7:32 pm #467665This reply has been marked as private.February 8, 2019 at 9:07 am #467773Hello, 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 
- 
		AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket