簡陋裝修 ClickComments
Sunday, June 10, 2007
pigazine 剛剛介紹 了一個叫 ClickComments 的服務,是用來讓你可以「一 click 灌水」,十分有趣。其站上有提供 WordPress Plugin 可以很簡單就安裝得到,它會在每篇文章的尾加入一些 Javascript 的代碼。不過如果想用 CSS 改動那個 Widget 的樣子則比較難,因為它會插入一個 iframe :(,極其量只可以控制「外觀」,亦因此要改一改 Plugin 的代碼,加上 CSS class 好控制:
將 ClickComments_wpPlugin.php 裏的這一句
- $content = $content . ‘<p><script type="text/javascript" src="http://www.postreach.com/ccengine/display_iframe?perlink=’ . $perlink . ‘&title=’ . $strTitle . ‘&url=’ . $blogURL . ‘"></script></p>’;
改成
- $content = $content . ‘<div class="postreachclickcomments"><script type="text/javascript" src="http://www.postreach.com/ccengine/display_iframe?perlink=’ . $perlink . ‘&title=’ . $strTitle . ‘&url=’ . $blogURL . ‘"></script></div>’;
然後就用 postreachclickcomments 這個 css class 去控制「外觀」,如本站現時是:
- .postreachclickcomments{
- text-align:right;
- }
- .postreachclickcomments iframe{
- border: 5px solid #ccc;
- text-align: right;
- background-color: #eee;
- padding: 5px;
- width:240px;
- }
希望他日會有更好的方法吧… 而不是只是 iframe…




