Address format per CPT

This topic contains 2 replies, has 2 voices, and was last updated by  Stiofan O’Connor 5 years, 5 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #455868

    Daniel Aston
    Expired Member
    Post count: 8

    How can we set a different address format for different CPTs and templates?

    #455869

    Daniel Aston
    Expired Member
    Post count: 8
    This reply has been marked as private.
    #455938

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Daniel,

    You can simply wrap them in conditions

    
    
    add_filter('geodir_cf_address_template','_my_new_address_format');
    function _my_new_address_format($format){
    global $post;
    
    if($post->post_type=='gd_place'){
    $format = "%%city_br%% %%region_br%% %%zip_br%% %%country%%";
    }else{
    $format = "%%street_br%% %%neighbourhood_br%% %%city_br%% %%region_br%% %%zip_br%% %%country%%";
    }
    
    return $format;
    }

    You can also use the geodir_is_page($page_type); function

    Stiofan

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

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

Open Support Ticket