zadd
Welkom bij Tasco
function custom_login_status_shortcode_callback() {
// Get the current user's information
$current_user = wp_get_current_user();
// Get the current language
$current_language = get_locale();
// Check the language and display the appropriate message
if (strpos($current_language, 'nl') !== false) {
// Dutch
if (is_user_logged_in()) {
return 'Welkom ' . esc_html($current_user->user_firstname);
} else {
return 'Inloggen';
}
} elseif (strpos($current_language, 'fr') !== false) {
// French
if (is_user_logged_in()) {
return 'Bienvenue ' . esc_html($current_user->user_firstname);
} else {
return 'Se connecter';
}
} elseif (strpos($current_language, 'en') !== false) {
// English
if (is_user_logged_in()) {
return 'Welcome ' . esc_html($current_user->user_firstname);
} else {
return 'Log in';
}
} else {
// Default to English if the language is not recognized
if (is_user_logged_in()) {
return 'Welcome ' . esc_html($current_user->user_firstname);
} else {
return 'Log in';
}
}
}
// Define the shortcode directly within the Shortcoder plugin
/*
* [custom_login_status_shortcode]
* output: php
*/
custom_login_status_shortcode_callback();
Welkom bij Tasco