verycd的title中常常会出现一些很有哲理性的句子,看上去很不错的样子,于是我想弄一个啊~可是自己还没有做wordpress plugin的经验,代码也没花太多时间去看~但我不会,还是有其他人会的,我可以修改其他人的plugin,达到我需要的效果!
挑个最简单的吧——Hello Dolly,wordpress自带的一个小plugin,平时没有激活过,功能也于我需要的效果差不多,代码简单。一切都符合我能修改的要求了,呵呵!
安装:
- 看看代码吧,把它保存为.php文件,上传到plugin文件夹中,然后后台激活
- 在你需要加上words的地方,加上(在theme上加)此句代码:<?php words();?>就可以了!
例如我放在title上,就在theme editer中选择Header Template,找到<title>…</title>把它修改成了
<title><?php bloginfo(‘name’); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?>- <?php words();?></title> - 如果你想修改或添加words,只需在plugin editer中打开words,找到如下句段,
$words = "I love you not because of who you are, but because of who I am when I am with you. No man or woman is worth your tears, and the one who is, won‘t make you cry. The worst way to miss someone is to be sitting right beside them knowing you can‘t have them. Never frown, even when you are sad, because you never know who is falling in love with your smile. To the world you may be one person, but to one person you may be the world. Don‘t waste your time on a man/woman, who isn‘t willing to waste their time on you. Don‘t try so hard, the best things come when you least expect them to. Don‘t cry because it is over, smile because it happened.";
修改为:
$words=’想要的句子一
想要的句子二
想要的句子三‘;
务必保证句子于句子间要换行! - 修改句子显示的格式(如果放在title上就不用了,改了也没用!),修改plugin中的
#words {
margin: 0; padding: 0;
font-size: 20px;
font-weight:bold;
color: #666;
}