Thứ Ba, 10/06/2025
Loading...
  • Login
Hoàng Giang Nam Blog
  • Home
  • WordPress
    • WordPress
    • Woocommerce
  • Windows
  • Office
  • Phần Mềm
  • Thủ thuật
  • Linux
    • Ubuntu
    • CentOS
    • VPS – Server
    • Web Server
No Result
View All Result
Hoàng Giang Nam Blog
  • Home
  • WordPress
    • WordPress
    • Woocommerce
  • Windows
  • Office
  • Phần Mềm
  • Thủ thuật
  • Linux
    • Ubuntu
    • CentOS
    • VPS – Server
    • Web Server
No Result
View All Result
  • Login
Hoàng Giang Nam Blog
No Result
View All Result
Home Wordpress
Function Dịch văn bản trong WP

Function Dịch văn bản trong WP

admin by admin
31/12/2024
Share on FacebookShare on Twitter

 

Hàm dịch một chuỗi văn bản cụ thể trong wordpress.

/* ################## Dịch tiếng Việt #################### */

// Dịch một chuỗi văn bản cụ thể
function ra_change_translate_text($translated_text) {
    if ($translated_text == 'Old Text') {
        $translated_text = 'New Translation';
    }
    return $translated_text;
}
add_filter('gettext', 'ra_change_translate_text', 20);

// Dịch nhiều chuỗi văn bản cùng lúc
function ra_change_translate_text_multiple($translated) {
    $text = array(
        'Quick View'          => 'Xem nhanh',
        'Leave a comment'     => 'Viết bình luận',
        'Continue reading'    => 'Đọc tiếp',
        'Forgot your password'=> 'Quên mật khẩu',
        'Not a member'        => 'Chưa có tài khoản',
        'Already a member'    => 'Đã có tài khoản',
        'Your username'       => 'Tài khoản của bạn',
        'Username'            => 'Tài khoản',
        'Your email'          => 'Email của bạn',
        'Password'            => 'Mật khẩu',
        'Confirm'             => 'Xác nhận',
        'Remember Me'         => 'Ghi nhớ tôi',
        'Get help'            => 'Trợ giúp',
    );

    // Thay thế chuỗi
    $translated = str_ireplace(array_keys($text), $text, $translated);
    return $translated;
}
add_filter('gettext', 'ra_change_translate_text_multiple', 20);

/* ###################### Kết thúc ###################### */

 

Tags: Wordpress
admin

admin

Next Post
Delete custom field in database wordpress

Delete custom field in database wordpress

Please login to join discussion

Recommended.

Hướng dẫn tạo và kích hoạt Swap trên VPS

Hướng dẫn tạo và kích hoạt Swap trên VPS

19/12/2024
Tự động cập nhật bản ghi DNS khi thay đổi IP

Tự động cập nhật bản ghi DNS khi thay đổi IP

01/01/2025

Trending.

HuananZhi X79 / X99 Motherboard BIOS POST codes

HuananZhi X79 / X99 Motherboard BIOS POST codes

01/01/2025
Tạo file IMG Windows.GZ bằng VM VirtualBox để cài đặt trên VPS Digitalocean, Linode

Tạo file IMG Windows.GZ bằng VM VirtualBox để cài đặt trên VPS Digitalocean, Linode

31/12/2024
Hướng dẫn lấy Client ID + Client Secret + Refresh Token Google Drive API

Hướng dẫn lấy Client ID + Client Secret + Refresh Token Google Drive API

19/12/2024
Cài đặt AApanel & TOR network

Cài đặt AApanel & TOR network

01/01/2025
Sử dụng Nginx làm Reverse Proxy cho nhiều trang web

Sử dụng Nginx làm Reverse Proxy cho nhiều trang web

18/12/2024
Hoàng Giang Nam

Blog chia sẽ kiến thức lập trình, source code, themes, plugin, phần mềm & thủ thuật máy tính...

Follow Us

Danh mục

  • CentOS
  • Chung
  • Server Email
  • Thủ thuật máy tính
  • Ubuntu
  • VPS – Server
  • Web Server
  • Windows
  • Woocommerce
  • Wordpress

Recent News

Disable Web Search Results in Windows 10/11 Start Menu

16/01/2025
Hướng dẫn lấy Client ID + Client Secret + Refresh Token Google Drive API

Hướng dẫn lấy Client ID + Client Secret + Refresh Token Google Drive API

19/12/2024
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2024 Hoanggiangnam.com

No Result
View All Result
  • Home
  • Phần Mềm
  • Thủ thuật máy tính
  • WordPress
  • Ubuntu
  • Office
  • Photography
  • Windows

© 2024 Hoanggiangnam.com

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Click to Copy