Sometimes you need to remove the datepicker default CSS style that comes with Toolset, for instance, when you are using a theme that has some datepicker styles already.
For your info, this file is in the common library and it’s present in several Toolset plugins.
add_action('wp_enqueue_scripts', 'remove_datepicker_styles', 100);
function remove_datepicker_styles(){
wp_dequeue_style('wptoolset-field-datepicker');
}
Add some parameter on datepicker when it has been initialized already, in a View.
jQuery(window).bind("load", function() {
jQuery( ".wpv-date-front-end" ).datepicker( "option", "yearRange", "2002:2012" ).datepicker("option", "defaultDate", "01012012");
});
Change a datepicker after initialization in CRED.
jQuery(window).bind("cred_form_ready", function() {
jQuery( ".js-wpt-date" ).datepicker( "option", "yearRange", "2002:2015" , ).datepicker( "option", "dateFormat", 'yy-M-dd' ).datepicker("setDate", 'November 24, 2017');
});
Inline (horizontal) custom language selector with different options such as Flags only, Code only, Flags + Code with divisor.
Take the time to study the code.
To use call wpml_custom_language_selector();
in a template
function wpml_custom_language_selector(){
// check if wpml is installed
if (function_exists('icl_get_languages')) {
// get active languages. Available params here:
// http://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
$languages = icl_get_languages('skip_missing=0&orderby=code&order=desc');
if(!empty($languages)){
echo '<div class="lang_selector">';
foreach($languages as $l){
// from this point on, uncomment whatever output you like
// flags only - do not display current language
/* if(!$l['active']){
echo '<a href="'.$l['url'].'">
<img src="'.$l['country_flag_url'].'" alt="'.$l['language_code'].'" />
</a>';
} */
// the output code options below will display the current language
// this adds an "active" class to the current language anchor
$class = $l['active'] ? ' class="active"' : NULL;
// code only
/*$langs .= '<a ' . $class . ' href="'.$l['url'].'">' . strtoupper ($l['language_code']). '</a> | ';*/
//flag-code divided by a |
/*$langs .= '<a ' . $class . ' href="' . $l['url'] . '"><img src="' . $l['country_flag_url'] . '" alt="' . $l['language_code'] . '" />' . strtoupper ($l['language_code']). '</a> | ';*/
}
// strip the empty space and | from last language
$langs = substr($langs,0,-3);
echo $langs;
echo '</div>';
}
}
}