Title: [Plugin: Geolocation] PHP Notices / Shortcode Question
Last modified: August 19, 2016

---

# [Plugin: Geolocation] PHP Notices / Shortcode Question

 *  [Philip Arthur Moore](https://wordpress.org/support/users/philiparthurmoore/)
 * (@philiparthurmoore)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-geolocation-php-notices-shortcode-question/)
 * Hi All.
 * Two issues:
 * 1. When Geolocation is activated and a new Post is published without setting 
   my location, I receive the following PHP notices:
 *     ```
       Notice: Undefined offset: 0 in /var/www/vhosts/server.com/sites/domainname.com/wp-content/plugins/geolocation/geolocation.php on line 537
   
       Notice: Undefined offset: 0 in /var/www/vhosts/server.com/sites/domainname.com/wp-content/plugins/geolocation/geolocation.php on line 537
   
       Notice: Undefined variable: city in /var/www/vhosts/server.com/sites/domainname.com/wp-content/plugins/geolocation/geolocation.php on line 522
   
       Notice: Undefined variable: city in /var/www/vhosts/server.com/sites/domainname.com/wp-content/plugins/geolocation/geolocation.php on line 524
   
       Notice: Undefined variable: state in /var/www/vhosts/server.com/sites/domainname.com/wp-content/plugins/geolocation/geolocation.php on line 526
   
       Notice: Undefined variable: country in /var/www/vhosts/server.com/sites/domainname.com/wp-content/plugins/geolocation/geolocation.php on line 528
   
       Notice: Undefined variable: address in /var/www/vhosts/server.com/sites/domainname.com/wp-content/plugins/geolocation/geolocation.php on line 531
       ```
   
 * 2. Is there any way to execute `[geolocation]` from my theme’s `functions.php`
   file? When I try to run `echo do_shortcode('[geolocation]');` in my theme’s `
   functions.php` file nothing happens and the plain text “[geolocation]” is output
   to the browser. If this won’t work, is there a way to change `add_filter('the_content','
   display_location', 5);` (located on line 31 of `geolocation.php`) without actually
   touching the plugin? I’d rather not package the plugin with my theme but I feel
   somewhat limited by the placement locations I’m offered. Thanks a lot.
 * [http://wordpress.org/extend/plugins/geolocation/](http://wordpress.org/extend/plugins/geolocation/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [ajohnson](https://wordpress.org/support/users/ajohnson/)
 * (@ajohnson)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-geolocation-php-notices-shortcode-question/#post-1956903)
 * having same issue of shortcode not running with do_shortcode code.
 *  [Erik Rubright](https://wordpress.org/support/users/edrubright/)
 * (@edrubright)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-geolocation-php-notices-shortcode-question/#post-1956992)
 * I had the same issue, this corrected it for me
 *     ```
       <?php
       if (function_exists('display_location')){
       	echo display_location("[geolocation]");
       } ?>
       ```
   
 *  [silvasonic](https://wordpress.org/support/users/silvasonic/)
 * (@silvasonic)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-geolocation-php-notices-shortcode-question/#post-1956997)
 * I’ve tried the default `<?php echo do_shortcode("[example_shortcode]"); ?>` to
   no avail as well (sorry, I’m new to WP **and** PHP).
 * I’m now using Erik’s suggestion and the link + map show up where I place the 
   code, but I was wondering if there was a way to encapsulate it in `<li>` tags
   for instance.
 * Should I just concatenate it? Something like `echo '<li>' . display_location("[
   geolocation]") '</li>' . '\n';`
 * Would that work?
 *  [silvasonic](https://wordpress.org/support/users/silvasonic/)
 * (@silvasonic)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-geolocation-php-notices-shortcode-question/#post-1956998)
 * I’ve just gone ahead and added the tags within the plug-in’s code itself. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Geolocation] PHP Notices / Shortcode Question’ is closed to 
new replies.

 * ![](https://ps.w.org/geolocation/assets/icon-256x256.png?rev=2871062)
 * [Geolocation](https://wordpress.org/plugins/geolocation/)
 * [Support Threads](https://wordpress.org/support/plugin/geolocation/)
 * [Active Topics](https://wordpress.org/support/plugin/geolocation/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geolocation/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geolocation/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [silvasonic](https://wordpress.org/support/users/silvasonic/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-geolocation-php-notices-shortcode-question/#post-1956998)
 * Status: not resolved