Map icon link

This topic contains 11 replies, has 2 voices, and was last updated by  Paolo 8 years, 4 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #67972

    Guy Willett
    Buyer
    Post count: 41

    When a map icon is selected, rather than showing the info bubble, I’d like to link directly to the listing’s website (in a new window).

    Any help much appreciated.Thanks in advance.

    #68016

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    that is not possible, clicking the map marker can only open the infowindow.

    Changing that would require a code customization and I’m not even sure that Google Maps script would allow you to do that.

    Thanks

    #68083

    Guy Willett
    Buyer
    Post count: 41

    Fair enough, thanks for getting back to me.

    Any idea how I can change the image link in the bubble to go to the listing’s website rather than the details page?

    #68209

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    I’m not sure what is your level of programming, but Stiofan yesterday passed me a function to unlink the listing title in the map bubble.

    You can find it here: https://wpgeodirectory.com/support/topic/map-bubble-without-hyperlink/#post-68000

    Personally I wouldn’t be able to point you in the right direction to modify it for your needs.

    But maybe you don’t need extra pointers?

    Let us know,

    #68928

    Guy Willett
    Buyer
    Post count: 41

    Thanks for the link. I’ll have a go but my progranmming skills are limited!

    #68975

    Paolo
    Site Admin
    Post count: 31206

    Let us know how you went, if you can’t get it to work, we can always ask for help to Stiofan.

    Thanks

    #69001

    Guy Willett
    Buyer
    Post count: 41

    I’m struggling!

    What I’m trying to do is set both the title and image links in the bubble to go to the listing’s website instead of the details page.

    Can we ask Stiofan for help please? How do we do that?

    #69214

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    this shuold work like this, if there is a website URL in the listing, it will redirect to it, if tere isn’t it will direct to the listing details page normally.

    
    
    unction my_change_bubble_title($html, $postinfo_obj, $post_preview){
            $srcharr = array("'", "/", "-", '"', '\');
            $replarr = array("′", "⁄", "–", "“", '');
    
        if (isset($postinfo_obj->geodir_website) && $postinfo_obj->geodir_website) {
            $ID = $postinfo_obj->post_id;
     $plink = get_permalink($ID);
            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8'));
     $link = '<a href="'.$plink.'">'.$title.'</a>';
     
     $website_link = esc_url($postinfo_obj->geodir_website);
     $title_link = '<a href="'.$website_link.'">'.$title.'</a>';
    
            $html = str_replace($link,$title_link,$html);
        }
    
    return $html;
    }
    add_filter('geodir_custom_infowindow_html','my_change_bubble_title',10,3);

    Let us know how you went,

    Thanks

    #69288

    Guy Willett
    Buyer
    Post count: 41

    That’s brilliant, thank you so much, it worked perfectly!

    I’d like to do the same for the bubble image link. Is it as simple as replicating this code and replacing $title with $image?

    #69352

    Paolo
    Site Admin
    Post count: 31206

    it isn’t as simple, it is actually a completely different function. This should be considered customizations and if you have many other requests like these, you should be looking for a developer to hire to help you out.

    Customizations are beyond support.

    Thanks

    #69541

    Guy Willett
    Buyer
    Post count: 41

    I don’t have any other requests, that was the last thing I needed to complete this site.

    Anyway, I found another way round the problem.

    Thanks again.

    #69632

    Paolo
    Site Admin
    Post count: 31206

    Thanks for letting us know 🙂

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

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

Open Support Ticket