សង្ខេប
ក្នុង WordPress មានវិធីច្រើនសម្រាប់ប្ដូរពាក្យ “Read More” ទៅជាអក្សរខ្មែរ៖
- ប្រើ Theme Customizer ប្រសិន Theme ផ្ដល់ជម្រើសផ្ទាល់ខ្លួន។
- កែសម្រួល functions.php ដោយបន្ថែម filter ងាយៗ។
- ប្រើ Loco Translate ដើម្បីបកប្រែ string ទាំងមូល។
- កែផ្ទាល់ក្នុង Theme Editor ប្រសិនចាំបាច់។
គ្រប់វិធីនេះ អ្នកអាចធ្វើបានពីផ្នែក Admin Dashboard ក្នុង Hostinger hPanel ដោយចូលទៅ WordPress Admin → Appearance ឬ Plugins។
១. កែតម្រូវតាម Theme Customizer
មួយចំនួន Theme មានផ្នែក Typography ឬ Blog Settings ដែលអាចប្ដូរ “Read More” បានផ្ទាល់៖
- Dashboard → Appearance → Customize។
- ស្វែងផ្នែក Typography, Blog ឬ Content Settings។
- រក option “Read More Text” → ប្តូរទៅអក្សរខ្មែរ (ឧ. “អានបន្ត”) → Publish។
វិធីនេះ ងាយស្រួលបំផុត ប៉ុន្តែអាស្រ័យលើ Theme របស់អ្នក។
២. កែសម្រួល functions.php
ប្រសិន Theme មិនមាន Customizer សម្រាប់នេះ អ្នកអាចបន្ថែម filter៖
- ចូល Appearance → Theme Editor (ឬ ដោនឡូដ theme folder និង open functions.php)។
- ភ្ជាប់កូដខាងក្រោមនៅចុងឯកសារ
functions.php
៖function modify_read_more_link() { return '<a class="more-link" href="' . get_permalink() . '">អានបន្ត</a>'; } add_filter( 'the_content_more_link', 'modify_read_more_link' );
- Update File ហើយ Refresh Site។
វិធីនេះអាចគ្របដណ្តប់លើ “Read More” ដែលបង្កើតដោយ
<!--more-->
tag
៣. ប្រើ Plugin Loco Translate
Loco Translate អាចរកហើយបកប្រែពាក្យ “Read More” តាមទូទៅ៖
- Dashboard → Plugins → Add New → ស្វែង “Loco Translate” → Install & Activate។
- ទៅ Loco Translate → Themes (ឬ Plugins ប្រសិនបើ button មកពី plugin)។
- ជ្រើស Theme របស់អ្នក → New language → ជ្រើស “Khmer” → Start translating។
- ស្វែង string “Read More” → បកប្រែជា “អានបន្ត” → Save។
វិធីនេះសមស្របសម្រាប់ theme/plugin ដែលចាំបាច់ localization
៤. កែប្រែលេខវិញក្នុង Theme Editor (បច្ចុប្បន្នភាពខ្លះ)
ខ្លះ Theme អ្នកប្រហែលត្រូវកែឯកសារ template ដូចជា content.php
ឬ archive.php
៖
- Appearance → Theme Editor → រើសឯកសារ template ដែលមាន
<a class="more-link" ...>
។ - ស្វែង
<?php the_content_more_link(); ?>
ឬRead More
string → ប្តូរទៅ “អានបន្ត”។ - Save និង Refresh।
វិធីនេះត្រូវប្រុងប្រយ័ត្ន ព្រោះកម្មវិធីនេះមិនសុវត្ថិភាពសម្រាប់អាប់ដេត theme
ចំណាំបន្ថែម
- Child Theme: ប្រសិនបើ Theme អ្នកអាប់ដែតជាទៀងទាត់ វិធី functions.php ឬ Theme Editor អាចបាត់បង់។ រក Child Theme ដើម្បីរួមបញ្ចូល custom code safely។
- Cache: បន្ទាប់បញ្ចូលកូដ ឬ plugin, កុំភ្លេច Clear Cache (ប្រសិនជាកំពុងប្រើ caching plugin ឬ Cloudflare) ដើម្បីឲ្យការផ្លាស់ប្តូរបង្ហាញ។
បើមានសំណួរបន្ថែម ឬចង់ឲ្យជួយភ្ជាប់ទ្រូងលំហាត step-by-step សូមអោយដឹង!
0 Comments:
Post a Comment