Map default marker icon w/o sub-category

This topic contains 4 replies, has 3 voices, and was last updated by  Stiofan O’Connor 6 years, 1 month ago.

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

Open Support Ticket
  • Author
    Posts
  • #421555

    kala konto
    Expired Member
    Post count: 38

    I am trying to have all my maps (home, listing and details page maps) to show my 1 default company icon.
    Why i just wont repeat the icon on category icon is that i need every category to have separate icon to display on details page later.

    I used both codes from this topic: https://wpgeodirectory.com/support/topic/map-icon/

    It worked perfectly with sub-categorys, but could it be tweaked to show defult icon (set at design>map>Upload map default marker icon) on all the maps all the time.

    The codes i used:
    (it pulls from higher cat id, but i dont want sub categorys, it just makes useless string for front and back end usage)

    
    
    add_filter('geodir_before_marker_post_process','_my_use_higher_cat_id');
    
    function _my_use_higher_cat_id($posts){
    
    	if(!empty($posts)){
    		foreach($posts as $key=>$post){
    			$pt = esc_attr($_REQUEST['gd_posttype']);
    			if(isset($post->{$pt.'category'})){
    				$cats = array_filter(explode(',',$post->{$pt.'category'}));
    				$post->default_category = max($cats);
    				$posts[$key] = $post;
    			}
    
    		}
    	}
    	return $posts;
    }
    add_filter('geodir_map_canvas_jason_detail_page_map_canvas','_my_edit_detail_marker',10,1);
    
    function _my_edit_detail_marker($map_canvas_jason_args){
    
    	echo '###';
    	print_r($map_canvas_jason_args);
    
    	return $map_canvas_jason_args;
    }
    #421674

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    I will flag your question for the developers, but I will also point out a snippet that can be used to change/substitute the category icon on the detail page.

    If your objective is to show the same icon, you could then use the same icon for all category icons and then substitute another image for display as the category icon on the detail page.

    One of the advantages of this approach is you can maintain all the image source code in one place making it easier to change them.

    On this page, look for the header: Detail Page – Snippet to substitute different category icons on the Detail page

    https://wpgeodirectory.com/docs/faqs/what-are-some-examples-of-changes-that-a-developer-can-make-to-the-listings-page/

    #422053

    kala konto
    Expired Member
    Post count: 38

    This code works allmost as i need to, only problem is that the maps in details page icons change also.
    Could there be added a “except for map” function or “only in details text area/tab)

    #422166

    Alex Rollin
    Moderator
    Post count: 27815

    I am sorry that what we have available doesn’t fit your case right now. We don’t undertake customizations here in the forum, but you can contact a GD Expert to work on these snippets to make them suit your site: https://geodirectoryexperts.com

    I have flagged your question for the developers in case they have an easy fix.

    #422245

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    wrap it in a clause

    
    
    if(!geodir_is_page('detail')){
    // if not the details page do stuff here
    }

    Stiofan

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

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

Open Support Ticket