2016-04-03 11 views
0

WP Googleマッププロプラグインhttp://www.flippercode.com/を私のサイトに使用して、店舗と場所のリストを表示しています。カスタムポストタイプのマップを表示したいです。このコードを使用しています。WP Google Map Proを1ページで動的に表示するにはどうすればいいですか?

$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幅のようなだけショートが来る= "100%" 高さ= "210" ズーム= "15" 言語= "EN" map_type = "ロードマップ" map_draggable = "true" をMARKER1 =」 27.7172453 | 85.3239605 | Pizza "]

do_shortcodeが動作していないか、コードにエラーがあります。

ありがとうございます。

+0

'add_shortcode'でショートコードを追加し、' do_shortcode'でそれを使う必要があります。 add_shortcodeの詳細https://codex.wordpress.org/Function_Reference/add_shortcode – zipkundan

+0

ありがとうございます。 –

答えて

0

私は[[$ maptextの[in $ 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); 
    } 

ご協力いただきありがとうございます。

関連する問題