随机显示6条友情链接

Posted by YangTx on Dec 28th, 2007 and filed under Software Reviews. You can follow any responses to this entry through the RSS 2.0. You can leave a response or trackback to this entry

wordpress的文档中可知,调用链接的格式化语句为:

<?php get_links(category, ‘before’, ‘after’, ’between’, show_images, ‘order’, show_description,show_rating, limit, show_updated, echo); ?>

按照默认值,每一个参数对应的含义为:

  • 显示所有链接
  • 每一个链接项后换行
  • 如果有图片,加入图片
  • 图片和文本之间加入空格
  • 按照链接名排序
  • 显示链接的说明
  • 不显示分级
  • 除非有限制,显示所有链接
  • 以链接而非文本形式显示链接

WordPress 随机显示6条友情链接的代码为:

<?php get_links(-1, ‘<li>’, ‘</li>’,0,0, ‘rand’, 0, 0, 6, 0); ?>

最后设置CSS样式(效果见右栏):

   <li class=”archives”><h2>Blogroll (Rand 6)</h2>
    <ul>
             <?php get_links(-1, ‘<li>’, ‘</li>’,0,0, ‘rand’, 0, 0, 6, 0); ?>
    </ul>
   </li>

Tags: WordPress

Related posts

Leave a Reply