昨天子曰兄在问WordPress随机调用友情连接的代码问题,今天把随即调用友情链接代码和CSS说明一下。另外再通俗的讲讲。非专业人士讲的话可能有些通俗,专业人士看了不要笑话就好,呵呵呵。

WordPress中调用友情链接的代码:

最简单的调用情况:

要实现随机调用的情况:

limit :限制显示数量
categorize :是否指定类别显示,大众使用一般选择0,不使用指定类别
orderby :显示友情链接顺序,参数包括:

  • id
  • url
  • name
  • target
  • description
  • owner :通过指定的添加人显示友情链接
  • rating
  • updated
  • rel :通过添加友情连接时添加的关系信息显示友链
  • notes
  • rss
  • length :由短至长显示友情链接
  • rand :随机显示友情链接

还有一个有用的参数order
ASC :顺序排列
DESC :倒序排列

另外如果显示链接过多、过长,影响美观,可以这样添加CSS属性改为两列甚至3列显示,首先是侧边栏sidebar.php

  1. <h3>Friend Links</h3>
  2. <div id=”list-class”></div>

在style.css文件中添加

  1. #list-class {
  2. line-height: 18px; text-align: left; margin:0 0 0 0px;
  3. }
  4. #list-class ul {
  5. padding:0px ;width:250px;
  6. }
  7. #list-class li {
  8. padding:2px 0px 2px 5px; width:100px; display:block; float:left;
  9. }

line-height设置行高,text-align设置对齐方式,float设置为左悬浮,这样友情链接就可以多列显示了。其他的可以看这篇文章链接

source:http://3xspace.cn/wordpress-blogroll-use0117.htm

相关文章

Tagged with:
 

One Response to WordPress友情链接调用及显示说明

  1. ZNZBLOG says:

    WP调用太繁琐了

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Set your Twitter account name in your settings to use the TwitterBar Section.