Show email address in Map bubble

This topic contains 5 replies, has 2 voices, and was last updated by  Simone 9 years, 6 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #17527

    ed@dupecreative.com
    Free User
    Post count: 5

    Hello,

    Can’t seem to find this anywhere – I want to add the email address of my custom post type into the bubble on the Map. I’ve found the code that processes this inside /geodirectory/geodirectory-functions/post_functions.php

    <?php if($contact){?><span class="geodir_contact"><i class="fa fa-phone"></i> <?php echo $contact;?></span><?php }?>

    This obviously shows the phone number, but I’ve tried other variables such as $email and $to_email but nothing is showing the email address.

    Can someone point me in the right direction?

    Thanks,
    Ed.

    #17529

    Simone
    Expired Member
    Post count: 3515

    Hello Ed,
    try this
    you can process the field and assign it to a variable such as

    
    
    
    global $wp_query;
    
    $postid = $wp_query->post->ID; //retrieve the id
    $emaillisting= geodir_get_post_meta($postid,'geodir_email',true); //email 
    
    #17530

    ed@dupecreative.com
    Free User
    Post count: 5

    Hi Simone, I tried this in the listings template and it worked great, but it doesn’t work for the info inside the bubble (post_functions.php)

    
    
    				<?php								 
    				global $wp_query;
    				$postid = $wp_query->post->ID; //retrieve the id
    				$emaillisting= geodir_get_post_meta($postid,'geodir_email',true); //email
    				?>
    
    				<span class="geodir_email"><i class="fa fa-envelope"></i><?php echo $emaillisting; ?></span>

    As I say, works fine in /geodirectory/geodirectory-templates/listing-listview.php

    Any idea why it would work in one and not the other?

    Thanks,
    Garry.

    #17531

    Simone
    Expired Member
    Post count: 3515

    Use only

    
    
    $emaillisting= geodir_get_post_meta($ID,'geodir_email',true); //email				
    								<span class="geodir_email"><i class="fa fa-envelope"></i><?php echo $emaillisting; ?></span>
    

    the id is already declared in post_functions.php (just saw it now) so you can use $ID rather than the $postid;

    tested and it works,
    enjoy

    S.

    #17533

    ed@dupecreative.com
    Free User
    Post count: 5

    thank you very much 🙂 !

    #17535

    Simone
    Expired Member
    Post count: 3515

    You’re very welcome 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

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

Open Support Ticket