Html Custom field – embed a google map route

This topic contains 36 replies, has 4 voices, and was last updated by  Paolo 6 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #385142

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385143

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385144

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    right just expalin fully what you are trying to do, i specifically asked you this in the alst queston, you are contradicting yourself

    “”The default listing address by geodirectory will be used as my destination location.”
    Do you mean the listing address or the default city address for the whole site.

    Just explain fully what the destinations are and what the point of all this is….

    #385145

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385157

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    OK so you only need the user to enter one further address, u could use this field to display its own tab or you could have it autofill the directions on the map tab so it will show rout and then directions below (if you need directions?)

    Stiofan

    #385162

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385163

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385166

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You could do either, you could have it on its own tab or make the map tab show the info and directions also. You don’t need any other plugins just a snippet of code.

    Stiofan

    #385177

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385185

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You could add a field called start poing with html variable as “startpoint”
    then add a plugin called “code snippets and add the below code snippet

    
    
    add_action('wp_footer','_my_map_route');
    function _my_map_route(){
    	if(geodir_is_page('detail')){
    		global $post;
    		if(isset($post->geodir_startpoint) && $post->geodir_startpoint){
    			?>
    <script>
    	jQuery(function() {
    	if(jQuery('#detail_page_map_canvas_fromAddress').length){
    		jQuery('#detail_page_map_canvas_fromAddress').val('<?php echo esc_html($post->geodir_startpoint);?>');
    		jQuery('#directions').trigger('click');
    	}
    	});
    </script>
    <?php
    		}
    	}
    }

    Thanks,

    Stiofan

    #385198

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385200

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385247

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Here is some updated code it will fix the map and only run on gd_place

    
    
    add_action('wp_footer','_my_map_route');
    function _my_map_route(){
    	if(geodir_is_page('detail')){
    		global $post;
    		if(isset($post->geodir_startpoint) && $post->geodir_startpoint && $post->post_type=='gd_place'){
    			?>
    <script>
    	jQuery(function() {
    
    		if(jQuery('#detail_page_map_canvas_fromAddress').length){
    			jQuery('#detail_page_map_canvas_fromAddress').val('<?php echo esc_html($post->geodir_startpoint);?>');
    			jQuery('#directions').trigger('click');
    		}
    
    		jQuery('.geodir-tab-head a[data-tab="#post_map"]').click(function(){
    			jQuery('#directions').trigger('click');
    		});
    
    	});
    </script>
    <?php
    		}
    	}
    }

    Stiofan

    #385269

    S
    Expired Member
    Post count: 62

    Thank you! It works well.
    The route however does not show up in the map tab on the preview page. How can I fix the problem? The review and related listings tabs also don’t show up on the preview page. Is it possible for these two tabs (with the up-to-date reviews) to show up as well on the preview page?

    #385329

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    u might be able to show it on the preview page by changing this line

    if(geodir_is_page('detail')){

    to this

    if(geodir_is_page('detail') || geodir_is_page('preview')){

    The other tabs are not shown on the preview page for a number of reasons.

    Thanks,

    Stiofan

Viewing 15 posts - 16 through 30 (of 37 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket