冰古blog » wordpress » 2005 » 06 » 11 » 小小plugin-类似verycd的title

小小plugin-类似verycd的title

verycd的title中常常会出现一些很有哲理性的句子,看上去很不错的样子,于是我想弄一个啊~可是自己还没有做wordpress plugin的经验,代码也没花太多时间去看~但我不会,还是有其他人会的,我可以修改其他人的plugin,达到我需要的效果!
挑个最简单的吧——Hello Dolly,wordpress自带的一个小plugin,平时没有激活过,功能也于我需要的效果差不多,代码简单。一切都符合我能修改的要求了,呵呵!

安装:

  1. 看看代码吧,把它保存为.php文件,上传到plugin文件夹中,然后后台激活
  2. 在你需要加上words的地方,加上(在theme上加)此句代码:<?php words();?>就可以了!
    例如我放在title上,就在theme editer中选择Header Template,找到<title>…</title>把它修改成了
    <title><?php bloginfo(‘name’); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?>- <?php words();?></title>
  3. 如果你想修改或添加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=’想要的句子一
    想要的句子二
    想要的句子三‘;
    务必保证句子于句子间要换行

  4. 修改句子显示的格式(如果放在title上就不用了,改了也没用!),修改plugin中的

    #words {
    margin: 0; padding: 0;
    font-size: 20px;
    font-weight:bold;
    color: #666;
    }

7 Responses to “小小plugin-类似verycd的title”

  1. […] 发现越来越少了,看来是阅读量太小了~~~想想人家能定1000多条FEED,我才几个啊~~~ 继续努力~~~! 冰古Blog ?Blog Archive ?小小plugin-类似verycd的title # 显示名言的~~~ […]

  2. Bingu says:

    :mrgreen::mrgreen:坚持就是胜利!

  3. 阿贵 says:

    冰古真的是好热心啊,谢谢了。:smile:
    后来我用了这个:Randomize。个人感觉比较好使,可以分成不同的目录,用在不同的地方,比如说一个目录中的东西用在标题,一个目录用在页顶图片转换,一个用于随机显示音乐,一个用于随机显示名言。可惜我只是一笼统地在用。呵呵,太懒。:roll:

  4. Bingu says:

    别放弃啊,我在海豚那里看见了一个类似的插件
    another random quote

  5. 阿贵 says:

    :sad:还不行。
    錢塗介绍的链接已经失效了。
    放弃。

  6. Bingu says:

    妳把最后一行改為這樣試試:
    //add_action(‘wp_head’, ‘words_css’);
    妳也可以試試錢塗介紹的類似的plugin
    http://www.qiantu.org/?p=483

  7. 阿贵 says:

    我用了,激活的时候出现:

    Warning: Cannot modify header information – headers already sent by (output started at /www/users/boofee.com/wp1/wp-content/plugins/words.php:50) in /www/users/boofee.com/wp1/wp-admin/admin.php on line 11

    后面还有,都差不多。请问是怎么回事呢?

Leave a Reply