Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #975231

    Hi Kriesi Forum,

    i would like to change the date format on a site. Atm i have dd/mm/yy and i would like to change it to mm/dd/YYY

    I found this solution on your forum.

    add_filter(‘avf_datepicker_dateformat’, ‘new_date_format’);
    function new_date_format() {
    $date_format = ” mm / dd / yy”;
    return $date_format;
    }
    add_filter(‘avf_datepicker_date_placeholder’, ‘new_date_placeholder’);
    function new_date_placeholder() {
    $placeholder = “MM / DD / YY”;
    return $placeholder;
    }

    Now the question:
    Can i do the change in the contact form on only one page, not generally on the site? For example on a page with the page id 709?

    Thank you

    #975234

    Hey,

    Please change the code to following one

    add_filter('avf_datepicker_dateformat', 'new_date_format');
    function new_date_format() {
    if(is_page(709){
    $date_format = " mm / dd / yy";
    }
    return $date_format;
    }
    add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder');
    function new_date_placeholder() {
    if(is_page(709){
    $placeholder = "MM / DD / YY";
    }
    return $placeholder;
    }

    Cheers!
    Yigit

    #975247

    Thank you for your fast reply.

    If i add this to child functions.php i get an error:

    Parse error: syntax error, unexpected ‘;’ in /homepages/1/d344731888/htdocs/clickandbuilds/DrFleischmannDental/wp-content/themes/enfold child/functions.php on line 11

    Thank you again

    #975255

    Hi,

    I cannot see any issue. Could you please post FTP and WP admin logins here privately so we can look into it?

    Cheers!
    Yigit

    #975270

    Hi,

    logins are privat. Thank you Yigit

    • This reply was modified 6 years, 5 months ago by fxkreative.
    #975298

    Hi fxkreative,

    I’ve added the code:

    
    add_filter('avf_datepicker_dateformat', 'new_date_format');
    
    function new_date_format() {
    	if(is_page(709)) {
    		$date_format = "mm / dd / yy";
    	}
    	return $date_format;
    }
    
    add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder');
    
    function new_date_placeholder() {
    	if(is_page(709)) {
    		$placeholder = "MM / DD / YY";
    	}
    	return $placeholder;
    }
    

    There was parenthesis missing. Please check.

    Best regards,
    Victoria

    #975372

    Thank you very much Victoria, works perfectly.

    Your support is also one of the reason why i choose enfold over other themes.

    A last request please. Now on the other contact page (Look private) the placeholder disappeared. It is the german contact form, can you please add a placeholder for the date again? (dd/mm/yy)

    If tried it via functions, but failed.

    Thank you again,

    #975745

    Hi fxkreative,

    You can add another conditional statement that Victoria gave and just copy it and replace 709 with 23, the code should look like this:

    add_filter('avf_datepicker_dateformat', 'new_date_format');
    
    function new_date_format() {
    	if(is_page(709)) {
    		$date_format = "mm / dd / yy";
    	}
    
    	if(is_page(23)) {
    		$date_format = "mm / dd / yy";
    	}
    
    	return $date_format;
    }
    
    add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder');
    
    function new_date_placeholder() {
    	if(is_page(709)) {
    		$placeholder = "MM / DD / YY";
    	}
    
    	if(is_page(23)) {
    		$placeholder = "MM / DD / YY";
    	}
    
    	return $placeholder;
    }

    Hope it helps.

    Best regards,
    Nikko

    #975787

    Thank you Yigit, Victoria and Nikko for the great support.

    It works perfectly, you can close the thread.

    Best regards,
    Sergej

    • This reply was modified 6 years, 5 months ago by fxkreative.
    #975795

    Hi,

    You are welcome!

    Please take a moment to review our theme and show your support https://themeforest.net/downloads

    Best regards,
    Yigit

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Change date format to mm/dd/yy’ is closed to new replies.