16/07/2021 6:26 pm
หัวข้อเริ่มต้น การแจ้งเตือน
ลบทั้งหมด
ธีม Plant
1 โพสต์
2 ผู้ใช้
0 Likes
1,200 เข้าชม
0
- หากต้องการให้ polylang language switcher แสดงผลบนมือถือด้วยจะมีแนวทางทำยังไงได้บ้างครับ ปัจจุบันบน desktop ใช้ widget แสดงผลในตำแหน่ง header action แล้วปรับ margin top ของ polylang language switcher เป็น 20px ก็แสดงผลได้ในระดับหนึ่ง หรือมีแนวทางในการนำ polylang language switcher มาใช้ได้ดีกว่านี้มั้ยครับ จริงๆ อยากจะนำมาแสดงต่อไอคอนค้นหา ซึ่งใน theme มีให้เลือก custom ได้ แต่ก็ไม่รู้ว่าจะแสดงผล widget ได้ยังไง
- Seed Buddhist Year จากที่ค้นดูกระทู้เก่าๆ เกี่ยวกับ polylang และ Seed Buddhist Year แล้ว เห็นว่าจะมีการอัพเดตให้สามารถแสดงผลได้เป็น พ.ศ. เมื่ออยู่ในหน้าภาษาไทย และ ค.ศ. เมื่ออยู่ในหน้าภาษาอังกฤษ ซึ่งตอนนี้ในภาษาอังกฤษจะแสดงผลเป็น พ.ศ. อยู่ครับ จึงไม่ทราบว่ามีแพลนที่จะปรับปรุงจุดนี้เมื่อไหร่ หรือพอจะให้แนวทางในการแก้ไขเบื้องต้นได้หรือไม่ครับ (ขออย่าแนะนำให้ทำเป็นเว็บแยกกันแต่ละภาษาเลยนะครับ)
1 คำตอบ
0
16/07/2021 9:23 pm
1. เรื่องแสดง Language Switcher ใส่ต่อในเมนูก็ได้นะครับ เช่นรูปนี้
2. เรื่อง Seed Buddhist Year ทีมคงยังไม่ได้ทำอีกนานพอควร ถ้าอยากแก้แบบง่ายๆ คือ เพิ่มโค้ดเช็คว่า ตอนนี้อยู่ภาษาอะไร ถ้าไม่ใช่ภาษาไทย ก็ปิดการทำงานของปลั๊กอินไป
ตัวอย่างโค้ด การเอา filter ในปลั๊กอินออก
ซึ่ง filter ในปลั๊กอิน คือ
add_filter( 'get_the_date', 'seed_buddhist_year_get_the_date', 10, 3 ); add_filter( 'the_date', 'seed_buddhist_year_the_date', 10, 4 ); add_filter( 'get_the_time', 'seed_buddhist_year_get_the_time', 10, 3 ); add_filter( 'the_time', 'seed_buddhist_year_the_time', 10, 2 ); add_filter( 'get_comment_date', 'seed_buddhist_year_get_comment_date', 10, 3 ); add_filter( 'get_comment_time', 'seed_buddhist_year_get_comment_time', 10, 5 );
ดังนั้น โค้ดที่ต้องเพิ่ม (เพิ่มใน functions.php หรือใช้ผ่านปลั๊กอิน My Custom Functions )
add_action( 'plugins_loaded', 'seed_remove_plugin_filter' ); function seed_remove_plugin_filter() { if (get_locale() != 'th') { remove_filter( 'get_the_date', 'seed_buddhist_year_get_the_date', 10, 3 ); remove_filter( 'the_date', 'seed_buddhist_year_the_date', 10, 4 ); remove_filter( 'get_the_time', 'seed_buddhist_year_get_the_time', 10, 3 ); remove_filter( 'the_time', 'seed_buddhist_year_the_time', 10, 2 ); remove_filter( 'get_comment_date', 'seed_buddhist_year_get_comment_date', 10, 3 ); remove_filter( 'get_comment_time', 'seed_buddhist_year_get_comment_time', 10, 5 ); } }