WordPress.org

Ready to get started?Download WordPress

Forums

Geo Mashup
[resolved] Geo mashup error - travel.php on line 44 (4 posts)

  1. PavelCZ1982
    Member
    Posted 1 year ago #

    Hi to all,

    I am using this perfect plugin but recently I am facing following error when I am using Geo mashup in my posts:

    Warning: Invalid argument supplied for foreach() in .../TheTravelTheme/travel/travel.php on line 44

    The code of travel.php was added by Geo mashup plugin and on line 44 is following:

    foreach($json_object['categories'] as $key => $id){

    The full code added from Geo mashup plugin in travel.php is:

    /*-----------------------------------------------------------------------------------*/
    /* Geo location category filter
    /*-----------------------------------------------------------------------------------*/
    function geo_mashup_locations_exclude_the_categorys($json_object,$object) {
    	$exclude = theme_get_option('blog','exclude_categorys');
    	foreach($json_object['categories'] as $key => $id){
    		if(!in_array($id,$exclude)){
    			unset($json_object['categories'][$key]);
    		}
    	}
    	return $json_object;
    }
    add_filter('geo_mashup_locations_json_object','geo_mashup_locations_exclude_the_categorys',10,2);

    I am using following theme http://thetraveltheme.com/, but problem is not in Theme, I am sure about this!

    Thanks for help in advance!

    Pavel

    http://wordpress.org/extend/plugins/geo-mashup/

  2. Dylan Kuhn
    Member
    Plugin Author

    Posted 1 year ago #

    That code will need an update for GM 1.5. The theme authors may eventually want to extend it to include taxonomies other than category, but this change should get things working:

    if ( isset( $json_object['terms']['category'] ) ) {
    	foreach($json_object['terms']['category'] as $key => $id){
    		if(!in_array($id,$exclude)){
    			unset($json_object['terms']['category'][$key]);
    		}
    	}
    }
  3. PavelCZ1982
    Member
    Posted 1 year ago #

    Thank you! You are the best!

    Pavel

  4. marcchiodi
    Member
    Posted 1 year ago #

    hi...i have the same issue too, but im totally blind in coding so how I change that code? which part? i tried to change it and got error.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.