Wordpress 如何在单个页面中动态显示WP Google Map Pro?

Wordpress 如何在单个页面中动态显示WP Google Map Pro?,wordpress,google-maps,Wordpress,Google Maps,我正在为我的网站使用WP Google Map Pro插件来显示商店和地点的列表。我想显示自定义后类型的地图,我正在使用此代码 $maptext = ''; if (get_post_meta(get_the_ID(), '_wpgmp_metabox_latitude', true) != '') { $locationlat = get_post_meta(get_the_ID(), '_wpgmp_metabox_latitude', true); $locatio

我正在为我的网站使用WP Google Map Pro插件来显示商店和地点的列表。我想显示自定义后类型的地图,我正在使用此代码

$maptext = '';
    if (get_post_meta(get_the_ID(), '_wpgmp_metabox_latitude', true) != '') {
    $locationlat = get_post_meta(get_the_ID(), '_wpgmp_metabox_latitude', true);
    $locationlong = get_post_meta(get_the_ID(), '_wpgmp_metabox_longitude', true);
    $maptext.= '[[display_map width="100%" height="210" zoom="15" language="en" map_type="ROADMAP" map_draggable="true" marker1="';
    $maptext.= $locationlat;
    $maptext.= ' | ';
    $maptext.= $locationlong;
    $maptext.= ' | ' . get_the_title() . '"]]';
    echo do_shortcode($maptext);
    }
但输出只是像这样的短代码 [display_map width=“100%”height=“210”zoom=“15”language=“en”map_type=“ROADMAP”map_draggable=“true”marker1=“27.7172453 | 85.3239605 | Pizza”]

你的短码不工作或我的代码有一些错误,我不明白


提前谢谢。

我发现了它的错误,原因是[[在$maptext中]

$maptext = '';
    if (get_post_meta(get_the_ID(), '_wpgmp_metabox_latitude', true) != '') {
    $locationlat = get_post_meta(get_the_ID(), '_wpgmp_metabox_latitude', true);
    $locationlong = get_post_meta(get_the_ID(), '_wpgmp_metabox_longitude', true);
    $maptext.= '[display_map width="100%" height="210" zoom="15" language="en" map_type="ROADMAP" map_draggable="true" marker1="';
    $maptext.= $locationlat;
    $maptext.= ' | ';
    $maptext.= $locationlong;
    $maptext.= ' | ' . get_the_title() . '"]';
    echo do_shortcode($maptext);
    }

感谢您的支持。

您必须首先使用
add\u shortcode
添加短代码,然后通过
do\u shortcode
使用它。有关add\u shortcode的更多信息非常感谢。