• 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.

    https://www.ads-software.com/extend/plugins/geolocation/

Viewing 4 replies - 1 through 4 (of 4 total)
  • having same issue of shortcode not running with do_shortcode code.

    I had the same issue, this corrected it for me

    <?php
    if (function_exists('display_location')){
    	echo display_location("[geolocation]");
    } ?>

    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?

    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.