PHP code example of wpbones / geolocalizer

1. Go to this page and download the library: Download wpbones/geolocalizer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wpbones / geolocalizer example snippets

 copy
add_filter('wpbones_geolocalizer_ipstack_api_key', function () {
    // get your api key rom your settings
    // for example, MyPlugin::$plugin->options->get('General/ipstack_api_key');
    return $your_api_key;
});
 copy
$info = MyPlugin\GeoLocalizer\GeoLocalizerProvider::geoIP();
 copy
use WPMyPlugin\WPBones\Foundation\WordPressShortcodesServiceProvider as ServiceProvider;
use WPMyPlugin\GeoLocalizer\GeoLocalizerProvider;

class WPMyPluginShortcode extends ServiceProvider
{

  /**
   * List of registred shortcodes. {shortcode}/method
   *
   * @var array
   */
  protected $shortcodes = [
    'my_shortocde_geo' => 'my_shortocde_geo',
  ];


  public function my_shortocde_geo( $atts = [], $content = null )
  {
    return GeoLocalizerProvider::shortcode( $atts, $content );
  }