Show author image แบบบ้านๆใน WordPress

Posted: November 22, 2008 in Wordpress Customize
Tags: , , ,

การให้ wordpress แสดงภาพของผู้เขียน ในกรณีที่มี Author หลายคนนะค่ะ

แบบบ้านๆเลยนะค่ะ …อันนี้ออกตัวไว้ก่อน

1.ขั้นแรกก็ save ชื่อรูปตาม ID ของ Author หรือลำดับของ user ซึ่งจะเป็น autonumber ตามลำดับการเพิ่มสมาชิกลงใน blog ของเรา ยกตัวอย่างเช่น admin คนแรกก็ต้อง ” 1.jpg” อยู่แล้ว

2.จากนั้น ก็ upload file ไปไว้

3. ก็เข้าไปใน menu design —->แล้วก็ Theme Editor 

เพิ่มใน index.php  ต่อจาก <?php while (have_posts()) : the_post(); ?> ล่างๆ อันนี้หน่อยอ่ะ

ใส่นี้เลย ข้างล่างเนี๊ย

———————————————————————————-

 <img src=”<?php get_bloginfo(‘url’);?>wp-content/uploads/authors/<?php the_author_ID(); ?>.jpg” class=”auth” alt=”<?php the_author();?>.” title=”<?php the_author();?>” >

———————————————————————————-

{ wp-content/uploads/authors/ } :ตรงนี้จะเปลี่ยนตามที่อยู่ของรูปที่เรา upload ไปเก็บไว้นะ

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s