HTML inside Marker-Popup | WordPress.org

[ad_1]

It works on my test page.

it was fine couple days ago, but now only raw text is being output.

What has changed on your installation? php version, a plugin, WordPress version, your script?
I’m using Query Monitor and the Developer Console to debug. And define('WP_DEBUG', true);.

Thread Starter
mjnswp

(@mjnswp)

the problem seems to be the content blocker from Real Cookie Banner. do you think there’s a way you could help me make it work?

I scanned my testing site with this (free) plugin. It detects OpenStreetMap, but it handles this in the pro version only.
I wrote my own DSGVO plugin, maybe it is enough for your site. You don’t need the Extensions to make it work.

P.S. Or ask the support of Real Cookie Banner.

  • This reply was modified 2 hours, 5 minutes ago by hupe13.

Thread Starter
mjnswp

(@mjnswp)

yeah seems like a Real Cookie Banner problem. thanks for your reply anyways!

if anyone else comes across this problem. it’s working if I wrap the popup html in htmlspecialchars().
but get_the_permalink was giving me errors, so I also had to cut the permalink and only use the path, like:


// cut permalink
$postlink = get_the_permalink();
$postlinkPath = parse_url($postlink)['path'];

// marker popup html in variable
$markerPopupContent = '<span class="infobox_ort">'.$acf_field_ort.'</span><h4 class="infobox_title">'.get_the_title().'</h4><div style="font-size:1.4rem;margin-bottom:1rem;">'.$acf_field_veranstaltungsadresse.'</div><a href="'.$postlinkPath.'" class="button inView" style="background-color:'.$acf_field_farbcode.';">Info</a>';

// output popup variable with htmlspecialchars()
echo do_shortcode('[leaflet-marker address="'.$acf_field_veranstaltungsadresse.'" svg background="'.$acf_field_farbcode.'"]'.htmlspecialchars($markerPopupContent).'[/leaflet-marker]');

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer