to display Google map on posts automatic

It is possible to display the map automatically on a custom post?
I have formidable pro to create entry's and i have assign the custom fields to google map.
Inside the post i have the address and lat, logt. coordinates.
I do not see the map at the end of the post.
I have configure the display bottom middle of posts.
Also van i have the name of the custom field for {Associate map with this post} so i can click it on entry form ?
Thanks a lot

  • Sajid

    Hi @nicolastergiopoulos,
    Hope you are doing good today :slight_smile:

    It does support custom post types. I tested it on my own website and its working just fine for me. Here is the link to one of custom post type I created for example.
    http://jwebsol.com/wpmu-single/project/test-project-for-google-map/

    Do you using custom template for that specific custom post type ? If yes then make sure you have the_content function being called. That is required to add form dynamically.

    Also, does it work with default WordPress posts or not ?

    Update: Regarding your question about getting the name of map, where exactly you want to display the map name ? It stored in custom WordPress table called your_prefix_agm_maps.

    Hope that helps! Feel free to post a reply here if you need further assistance :slight_smile:
    Cheers, Sajid

  • nicolas

    Hello.
    Thanks for checking.
    I am not ignoring you. I am looking to find what is going on with views on formidable pro.
    about the function the content.
    view replace the content of a post
    can you help how to do that.
    I have those two codes
    frm_before_display_content
    https://formidablepro.com/knowledgebase/frm_before_display_content/
    frm_after_display_content
    https://formidablepro.com/knowledgebase/frm_after_display_content/
    Thanks a lot

  • Panos

    Hello @nicolastergiopoulos,

    Regarding the Google Maps plugin, you can insert a map in your Custom Post Type by clicking on the map button above the text editor. In case you need to insert the map in a separate field instead of the content, you may use the map's shortcode, eg [map id="1"].

    I'm not sure I understand what it is you need to do with the "frm_after_display_content" and "frm_before_display_content" hooks of the formidable pro plugin. I should also note that I am not aware of how this third party plugin works as it is a premium plugin, but I will try
    and figure from our discussion :slight_smile: Please provide some more information about what you need to do, so we can offer further assistance!

    Just in case you need to display a map inside the content by using one of the above filters you may try out something like this:

    add_filter('frm_before_display_content', 'dynamic_frm_stats', 10, 4);
    function dynamic_frm_stats($content, $display, $show, $atts){
    	if($display->ID == 1066){//Change 1066 to the ID of your View
    	$map_content = '';
    
    	ob_start();
            echo do_shortcode( '[map id="1"]' );
            $map_content = ob_get_clean();
    
            $content .= $map_content;
    	}
    	return $content;
    }

    Perhaps using WordPress' 'the_content' hook may be handy. For example:

    add_filter( 'the_content', 'nicolas_display_map_incptcontent' );
    
    function nicolas_display_map_incptcontent( $content ){
         global $post;
    
         if( $post->ID == 1099 ){
              $map_content = '';
    
    	  ob_start();
               echo do_shortcode( '[map id="1"]' );
               $map_content = ob_get_clean();
    
               $content .= $map_content;
         }
    
    return $content;
    
    }

    Please do not try any of the above snippets in a live installation as they have not been tasted, instead try them out in a testing installation similar to your live one.

    Looking forward for your reply!

    Kind regards,
    Panos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.