Plugin, Wordpress

วิธีแบ่ง Comment ออกเป็นหลายๆหน้า

ถ้าคุยเคยเจอปัญหาเวลาที่ Blog ของคุณมีคนมา Comment มากๆ มากเสียจนหน้านั้นมันยาวเหยียด โหลดก็ช้า สบายใจได้แล้วครับ วันนี้ผมมี plugin มาเสนอ รับรองว่าใช้แล้ว ปัญหา Comment ยาวเหยียดจะหมดไป เพราะต่อไปนี้ Comment ของคุณจะถูกแบ่งออกเป็นหน้าย่อยๆครับ

Wordpress Paged Comment Plugin เป็นโปรแกรมที่ช่วยแบ่งหน้าของ Comment ใน post ของคุณออกเป็นหน้าย่อยๆ เพื่อไม่ให้ใช้เวลาโหลดที่มากเกินไป โดยเฉพาะที่มี Comment กันเป็นร้อยๆ พันๆ Comment

1. ไป Download plugin ได้ที่นี่เลยครับ

2. Unzip ออกมา จะได้ไฟล์ชื่อ paged-comments-config-sample.php ให้แก้เป็นชื่อ paged-comments-config.php

3. แล้ว upload ไฟล์ paged-comments.php กับ paged-comments-config.php ไปไว้ใน folder /wp-content/plugins/ ของเรา

4. เข้าไปยัง folder /paged-comments-plugin/themes/ ของ plugin นี้ จะเห็น folder ของ theme อยู่ ให้หาชื่อ theme ที่ตรงกับที่เราใช้ เพราะว่าเราจะต้อง upload file อีก file แต่ถ้าหาไม่เจอ ให้เลือก default ครับ

5. เมื่อเข้าไปใน folder ของ theme ที่ตรงกับเราแล้ว เช่น default ให้ upload comments-paged.php (/paged-comments-plugin/themes/default/comments-paged.php) ไปยัง folder themes ของเราบน /wp-content/themes/ บน server wordpress ของเรา

6. Login ไปที่ wp-admin ของเราแล้วเข้าไปที่ Presentation > Theme Editor แล้วเลือกแก้ไข file Single Post (single.php) กับ Page Template (page.php)

7. หา tag comments_template(); แล้วแก้เป็น if (function_exists(’paged_comments_template’)) paged_comments_template(); else comments_template();
paged-comment1.jpg

paged-comment2.jpg

8. Save แล้วไป Activate Plugin ได้เลย แค่นี้ก็เสร็จแล้วสำหรับ WP2.0

หน้าตาตัวอย่างที่แบ่งหน้า Comment แล้ว

paged-comment3.jpg

เรายังสามารถเรียงลำดับของ Comment ได้ กำหนดจำนวน Comment ต่อหน้า และยังสามารถทำ SEO friendly ของ link ของ Comment หน้าอื่นๆได้ โดยแก้ไขใน file paged-comments-config.php

หวังว่าคงเป็นประโยชน์สำหรับ Blog ยอดฮิตหลายๆท่านนะครับ :D



เรื่องที่น่าจะเกี่ยวข้องกับเรื่องนี้

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

*Required Fields