How to add a facebook like button to wordpress?

1. Generate your custom like button and get script.
http://developers.facebook.com/docs/reference/plugins/like/

2.  Modify your wordpress theme file.
e.g. /wp-content/themes/theme-name/content-single.php

Find “</header>” and insert FB script before it.

<iframe src=”//www.facebook.com/plugins/like.php?href=<?php the_permalink(); ?>&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=dark&amp;font=verdana&amp;height=35&amp;appId=233086249908″ scrolling=”no” frameborder=”0″ style=”border:none; overflow:hidden; width:450px; height:35px;” allowTransparency=”true”></iframe>

Replace href value to “<?php the_permalink(); ?>”.

Note: Test on WordPress 3.4.2.

PHP Session – 一次只能建一個連線

有個需求想用 PHP 來驗證身份,再傳出檔案,

不過遇到一個問題,

若是用 PHP 的 Session 函數 來使用 Session,

會發生同一個Session ID ,同時只能抓一個檔案,

也就是說要同時抓兩個的話,

第二個就要等第一個抓完,連線才會通,

所以目前只好自己寫個簡單的 Session 來解決這個問題。