Home › Forums › MapPress Support › MashUp: Shortcodes in Post-Excerpt
Tagged: mashup, popup custom temülate
- This topic has 4 replies, 1 voice, and was last updated 2 years, 2 months ago by
Chris.
-
AuthorPosts
-
November 23, 2020 at 7:16 am #18752
Hi Chris!
I am working on a mashup where the WP-Theme and Pagebuilder is DIVI.
The POIs in that mashup are retrieved from automatic maps where the geocoding field = Adress line 1 = custom field “projektadresse”This all works well.
The POI Content ist set to “<label><input checked=”checked” name=”mappress_options[mashupBody]” type=”radio” value=”poi” />POI title + POI body”</label>
I want the “Post title” as POI-Title and the geocoding field / custom field “projektadresse” as POI-BodyThe alternative option “POST title + POST excerpt” is unusable, because DIVI loads a big bunch of short-codes into the postbody and post excerpt:
How should I define the map popup template?
this is not working:<div class=’mapp-title’>{{{post.title}}}</div>
<div class=’mapp-body’>{{poi.props.projektadresse}}</div>November 23, 2020 at 7:21 am #18753Hi,
The way you have the template looks right, the plugin should pick up the projektaddresse custom field.
But did you edit the ‘map popup’ or the ‘mashup popup’? Since it’s a mashup, you need to put that code in the ‘mashup popup’ template.
November 24, 2020 at 5:32 am #18759Dear Chris, I think I was not clear enough.
This is the Mashup: https://www.vorpommersche-kueste.de/aktuelle-projekte-3-2/
it works wellI looked into the template for map-popup, but the template for mashup-popup brings this result, see screenshot:
You see this does not show relevant informationI need the posttitle in the title and the adress in the body.
This picture shows the content of the PopUp in the MashUp when “PostTitle + PostExcerpt” is defined in the settings
My whish is instead of getting all these DIVI-shortcodes in the mapp-body and the adress in the mapp-title:
In the mapp-title the Post-Title
mapp-title = custom field ‘projektadresse’
I tried this code:
<div class=’mapp-title’>{{{post.title}}}</div>
<div class=’mapp-body’>
{{{poi.thumbnail}}}
{{poi.props.projektadresse}}
</div>
<div class=’mapp-links’><?php _e(‘Directions’, ‘mappress-google-maps-for-wordpress’); ?><div>How to create the code for the mashup-popup?
Thanks for your help, Connie
November 24, 2020 at 5:38 am #18760Hi,
I see the mashup here:
https://www.vorpommersche-kueste.de/aktuelle-projekte-3-2/Your code for the mashup popup looks OK. But at the URL above, it doesn’t look like the mashup popup template has been modified. Could you save the template so I can see the result on the mashup map?
November 24, 2020 at 9:34 pm #18770Hi Chris,
the MashUp is working with the setting “POI Title + POI Body”
It is triggered by this shortcode:[mashup query="meta_key=projektadresse&posts_per_page=-1"]
and uses the standard Mashup-PopUp-Template
===================
<div class=’mapp-title’>{{{poi.title}}}</div>
<div class=’mapp-body’>
{{{poi.thumbnail}}}
{{{poi.body}}}
</div>
<div class=’mapp-links’><?php _e(‘Directions’, ‘mappress-google-maps-for-wordpress’); ?><div>
===================
I reverted POI-content-setting to the standard “POI-Title + POI body”, but the result is not what I really need.When I change the POI-content-setting to “Post Title + Post Body” I get the postbody with all the DIVI-shortcodes and no readable content (see screenshot above)
That is why I am asking how to define the template to get this result:
the mapp-title => PostTitle
the mapp-body => custom field “projectadresse”and whether I have to change the setting “POI content” with a template like this.
Please tell me the correct code for the mapp-body as I don’t understand the syntax in the documentation
<div class=’mapp-body’>
{{{poi.thumbnail}}}
{{{ “CUSTOM FIELD PROJECTADRESSE ” }}}
</div>Cheers, Connie
November 24, 2020 at 9:42 pm #18771Hi,
To get what you want you’ll need to make the mashup setting “Post title and excerpt”. Then, enter the code you originally posted into the mashup-popup template:
<div class='mapp-title'>{{{post.title}}}</div> <div class='mapp-body'>{{poi.props.projektadresse}}</div>
I think I see the problem: when I pasted in your code, it contained curly quotes ( ’ ) instead of straight quotes ( ‘ ). Only straight quotes are allowed for HTML attributes. If you use the version above, it should work.
If that doesn’t help, please create the template as shown above and then *leave it active* so I can see it in the mashup (or send a login to the site for that purpose).
November 25, 2020 at 9:02 am #18772I did what you suggested, but now the POIs don’t pop up
I reverted to the original status and send you an email
Cheers, Connie
November 25, 2020 at 9:04 am #18773Hi Connie,
Thanks, being able to see the map was a big help, and I think it’s working now.
I found two issues:
1. For the title, it’s ‘poi.title’ not ‘post.title’
2. The plugin uses the default template when viewing a mashup in the admin. But for some reason, you site was setting the admin flag even when viewing the mashup on the frontend.For #2, I removed the admin check in the copy of MapPress that is on your site. I’ll also include that change in the next release.
November 26, 2020 at 8:44 am #18774Dear Chris, thank you!
This is what I wanted to acchieve!
Well, you correct that post.title should be set instead of poi.title. This was set because I had to reset the map to the “old behaviour” until the final version was finished.
Thank you, now can tell the users that the map is showing the desired content,
another plus for MapPress Pro!
Connie
-
AuthorPosts
- You must be logged in to reply to this topic.