IFrame not showing Google Maps embed listing

I must first refernce on this post Set iframe display format for the attribute - #5 by damian-mordarski

I tried to embed google maps code and followed above community post, added snippet, changed slug name, changed to url attribute (since not worked with “embed”) but still i didnt manage to display google maps.

I do know that you have geolocation plugin but that doesnt serve me well so i need to serve maps on this way (using embed code).

Here is screenshot of code i get when hover on iframe

This is php snippet i added

add_filter( 
	'hivepress/v1/models/listing/attributes', 
	function ($attributes){
		if(isset($attributes)){
			$attributes['gmec']['display_format'] = '<iframe src="%value%"></iframe>';
		}

		return $attributes;
	}, 
	1000
);

So to summarize, in the community post i attached above, guy confirms that he solved problem with displaying maps when he appilied your suggestions, but somehow i dont managing to reproduce his success.

I compared his html code and mine and is clearly visibile that in line “#document” his site doesnt point to root post, there isnt any link to his site at all.

In mine case i see link that point to root post thats why i get diplayed iframe that is showing my root post

Hi,

This issue occurs because the URL attribute adds the link display format if there’s no link HTML tag hivepress/includes/fields/class-url.php at master · hivepress/hivepress · GitHub There are different workarounds to prevent this, e.g. you can try using another attribute type like Text (but set the “display_type” to URL for the “edit_field” of the attribute), or override the “display_template” of the attribute field via the hivepress/v1/models/listing hook since it has a higher priority.

Hope this helps

Hi Ihor,

Thanks for you answer but i am not a developer to understand what i need to do in this case. Maybe if you can write me some extra steps to to try to solve this problem.

Thanks in advance.

Hi,

If you add listings as an admin without users, the easiest way to do it without using code is to add attributes with the text type and paste the URL there, add an iframe to the display format.

Also, if you are adding listings in another way, the easiest option is to use the Geolocaiton extension, as this is the official option for adding maps where no coding is required.

In addition, please note that other options for adding may require custom implementation.

​I hope this is helpful to you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.