Support » Plugin: Comprehensive Google Map Plugin » Custom Field as destination

  • Resolved Miki80


    Hello, thanks for the great plugin!!!

    Can you/someone please help me with the following,with my limited knowledge of php but with great effort i have not been able to get this working, please see the code below.

    Function to get the custom field:

    // Get Custom Field Template Values
    function getCustomField($theField) {
       global $post;
       $block = get_post_meta($post->ID, $theField);
    	foreach(($block) as $blocks) {
    	echo $blocks;

    Then I try to create a proper string to use as shortcode

    $content = "[google-map-v3 width=\"350\"

    The problem is that whatever I try the custom field gets inserted in front of the shortcode and not at the location where it is in the string.

    Swiss[google-map-v3 width="350" height="350" zoom="4" addmarkerlist=""{}1-default.png\" ... etc

    Have tried multiple themes, getting the same result, what am I doing wrong ???
    Any help or other solution is much appreciated


Viewing 1 replies (of 1 total)
  • using WP query instead of the function above did the trick.

    global $wp_query;
    $postid = $wp_query->post->ID;
    $dest = get_post_meta($postid, 'cf_destination', true);

    then I can use $dest in the addmarkerlist shortcode.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Field as destination’ is closed to new replies.