Dutch adres syntax

This topic contains 14 replies, has 6 voices, and was last updated by  ict con 10 years, 3 months ago.

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #5021

    mkblogic
    Expired Member
    Post count: 5

    Hello there,

    When showing address at right sidebar it show like this:

    Adres: [STREET]
    [CITY]
    [REGION]
    [ZIPCODE]
    [COUNTRY]

    I would change it to this:

    Adres:
    [STREET]
    [ZIPCODE] [CITY]

    This is how in the Netherlands addressen are formated.

    Please help.

    #5029

    Guust
    Moderator
    Post count: 29970

    Hi, mkblogic
    Right now there is no quick solution for it but we will surely look into it and get back to you.

    #5030

    mkblogic
    Expired Member
    Post count: 5

    If needed I can edit the php source?

    #5037

    PSI
    Free User
    Post count: 68

    I would also like todo that! 1+ Can you tell us in which file this can be found?

    Thanks!

    #5038

    PSI
    Free User
    Post count: 68

    .

    #5040

    Vikas
    Full Member
    Post count: 1128

    Hi,

    There is a filter available in the code plz use this code and put it in ur themes’ functions.php file

    
    
    
    add_filter('geodir_show_post_address', 'geodir_change_address_order' , 100 , 2) ;
    function geodir_change_address_order($html , $vars)
    {
    	global $post, $preview, $wpdb;
    	$field_icon='';
    	if (strpos($field_icon,'http') !== false) {$field_icon_af = '';}
    		elseif($field_icon==''){$field_icon_af = '<i class="fa fa-home"></i>';}
    		else{$field_icon_af = $field_icon; $field_icon='';}
    	
    	if(!$preview)
    	{
    		$html = '<p class="" style="clear:both;" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
    		$html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
    		$html .=  '&nbsp;';
    		$html .= '</span>';
    		//print_r($_POST);
    		
    		if($post->post_address){ $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';}
    		if($post->post_zip){ $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';}
    		if($post->post_city){ $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';}
    		if($post->post_region){ $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';}
    		if($post->post_country){ $html .= '<span itemprop="addressCountry">'.$post->post_country.'</span><br>';}
    		$html .= '</p>';
    	}
    							
    			
    	
    	return $html ;
    }
    
    #5053

    mkblogic
    Expired Member
    Post count: 5

    Many thanks. This works!!

    #5312

    sfamilia
    Buyer
    Post count: 82

    Vikas,

    I tried placing this code in my child themes functions.php and it did not work… does this need to be placed in the parent theme file instead?

    Sal

    #5357

    Guust
    Moderator
    Post count: 29970

    Hi Sal, I alerted Vikas, but as far as I know, it should be in the child theme’s functions.php.
    Try never to touch the files of a theme or a plugin unless you really have to, all changes will be deleted when you upgrade your plugin.

    #5372

    Vikas
    Full Member
    Post count: 1128

    Hi,

    I asked u to follow this post because this is similar to ur request. In this user asked to put zip code before the city name. So plz check i just simply put zip code parameter before city name. Now plz adjust all these variable as per ur format need, remove
    where u dont need a new line or something.

    Please advise ?

    #23607

    ict con
    Expired Member
    Post count: 44

    Hello,

    i have added it to the childtheme(avada) functions.php but it doesn’t seem to work. am i missing something ?

    Regards,

    #23618

    Guust
    Moderator
    Post count: 29970

    @ict con
    Yes, you need to adjust it to suit your requirements.
    How does a Dutch address look like?

    #23682

    ict con
    Expired Member
    Post count: 44

    The adres format looks like this:

    [STREET]
    [ZIPCODE] [CITY]
    [COUNTRY]

    I would like to change the right bar a detail listing and make Region not a required field at the add listing post forms.

    Regards,

    #23683

    Guust
    Moderator
    Post count: 29970

    Ok, below is the code you got to add to your child theme’s functions.php, and see here for an example: http://goldroo.net/attractions/attractions/guust/

    
    
    add_filter('geodir_show_post_address', 'geodir_change_address_order' , 100 , 2) ;
    function geodir_change_address_order($html , $vars)
    {
    	global $post, $preview, $wpdb;
    	$field_icon='';
    	if (strpos($field_icon,'http') !== false) {$field_icon_af = '';}
    		elseif($field_icon==''){$field_icon_af = '<i class="fa fa-home"></i>';}
    		else{$field_icon_af = $field_icon; $field_icon='';}
    	
    	if(!$preview)
    	{
    		$html = '<p class="" style="clear:both;" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
    		$html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
    		$html .=  '&nbsp;';
    		$html .= '</span>';
    		//print_r($_POST);
    		
    		if($post->post_address){ $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';}
    		if($post->post_zip){ $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span>&nbsp;';}
    		if($post->post_city){ $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';}
    		if($post->post_country){ $html .= '<span itemprop="addressCountry">'.$post->post_country.'</span><br>';}
    		$html .= '</p>';
    	}
    	return $html ;
    }

    That removes the province from the address, but you will need that for the Add Listing form. You might be able to hide it with CSS but not that might give trouble if there are 2 towns with the same name in a different province.
    This would hide it:

    #geodir_post_region_row {display: none;}
    #23810

    ict con
    Expired Member
    Post count: 44

    Works like a charm 🙂

    Thx !!

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount