2 new shortcodes suggestion
-
Hi Masikonis,
I recently installed your plugin and very much like the simplicity. During implementation I saw the need of multi country display/hide, so I would like to suggest add to the plugin repo 2 new functions or modification of the existent ones.
Here are the new functions:
add_shortcode( 'geolocator_multi_show', array( $this, 'geolocatorMultipleShowShortcode' ) ); add_shortcode( 'geolocator_multi_hide', array( $this, 'geolocatorMultipleHideShortcode' ) ); function geolocatorMultipleShowShortcode( $attributes, $content = null ) { $location = $this->location; if( ! empty( $location ) && array_key_exists( 'for', $attributes ) ) { $for = trim( $attributes['for'] ); // Country 2-letter ISO code if ( strpos($for,',') !== FALSE ) { if ( in_array( $location['country'], explode(',', $for) ) ) { return $start_tags . $content . $end_tags; } } else { if( $location['country'] == $for ) { return $start_tags . $content . $end_tags; } } } return ''; } function geolocatorMultipleHideShortcode( $attributes, $content = null ) { $location = $this->location; if( ! empty( $location ) && array_key_exists( 'for', $attributes ) ) { $for = trim( $attributes['for'] ); // Country 2-letter ISO code if ( strpos($for,',') !== FALSE ) { if ( ! in_array( $location['country'], explode(',', $for) ) ) { return $start_tags . $content . $end_tags; } } else { if( $location['country'] !== $for ) { return $start_tags . $content . $end_tags; } } } return ''; }
Hope this helps extending the functionality ??
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘2 new shortcodes suggestion’ is closed to new replies.