WP-PostViews Plus 函數示範

Wordpress Add Comment

 如果對函數的顯示有問題的人,請回到外掛的討論頁面發表問題。
If you hace any question about the function. Please go back to the plugin page and ask for help.

the_views(’ Views’, true);
456 Views

the_user_views(’ Views’, true);
143 Views

the_bot_views(’ Views’, true);
313 Views

get_most_viewed(”, 5, 0 , true , true);

  • WordPress Plugin :: WP-PostViews Plus – 10,912 Views
  • 留言版 – 4,479 Views
  • 世界七大奇景 – 3,803 Views
  • 所有回應列表 – 3,679 Views
  • 程式作品列表 – 3,305 Views
  • get_most_viewed_category(75, ”, 5, 0, true, true);

  • JpGraph :: php的繪圖物件 – 954 Views
  • 移除lexbce服務,解決print spooler無法啟動問題 – 950 Views
  • NextGEN Gallery 正體中文化(更新至 0.93) – 887 Views
  • 全球丁丁大戰 – 826 Views
  • phpBB3 倒數計時 – 746 Views
  • get_timespan_most_viewed(”, 5, 60, true, true, 0);

  • WordPress 2.5 後台預覽 – 664 Views
  • 函數示範 – 456 Views
  • 【Google AdSense 條款及細則】變更 – 313 Views
  • 無聊再度變更佈景主題 – 309 Views
  • 【工商服務】3M 隨手黏 – 309 Views
  • get_timespan_most_viewed_cat(79, ”, 5, 60, true, true, 0);

  • 函數示範 – 456 Views
  • 搞笑的小朋友~ – 237 Views
  • 【工商服務】星光傳奇 – 83 Views
  • 生日快樂 – 66 Views
  • Google Search – 0 Views
  • get_totalviews(true,true);
    103,652

    Tags: , , , , ,
    5,708 Views | 四月 15th, 2008 | Permanent Link:WP-PostViews Plus 函數示範

    wp_tag_cloud函数使用说明

    Wordpress Add Comment

    描述

    wordpress 2.3版或以上可用。wp_tag_cloud这个模板标签将显示一列标签,即所谓的标签云图,标签使用的次数决定了它的尺寸。

    用法

    1. <?php wp_tag_cloud(); ?>

    例子

    默认值

    1. $defaults = array(smallest => 8, largest => 22,
    2.   unit => pt, number => 45, format => flat,
    3.   orderby => name, order => ASC,exclude => , include => );

    默认显示:

    • smallest – 使用最少的标签的字号为8
    • largest – 使用最多的标签的字号为22
    • unit – 使用’pt’(点)作为最小和最大字号的单位
    • number – 显示最多45个标签
    • format – 使用平面风格显示标签(标签之间用空格分隔)
    • orderby – 以名称排序
    • order – 升序显示
    • exclude – 不排除任何标签
    • include – 包含任何标签

    在“热门标签”下显示云图

    1. <?php if ( function_exists(wp_tag_cloud) ) : ?>
    2. <li>
    3. <h2>Popular Tags</h2>
    4. <ul>
    5. <?php wp_tag_cloud(smallest=8&largest=22); ?>
    6. </ul>
    7. </li>
    8. <?php endif; ?>

    云图减少显示的个数和用使用次数代替名称排序

    1. <?php wp_tag_cloud(smallest=8&largest=22&number=30&orderby=count); ?>

    参数

    smallest
    (整数) 使用最少的标签的字号 (单位由unit参数给出).
    largest
    (整数) 使用最多的标签的字号 (单位由unit参数给出).
    unit
    (字符) 标签字号的单位。 他可以是任何CSS长度单位, 例如: pt, px, em, %; 默认为pt (点).
    number
    (整数) 云图显示标签的个数。 (使用“0”将显示所有标签。)
    format
    (字符) 云图显示的格式。

    • ‘flat’ (默认)标签用空格分隔
    • ‘list’ 标签置于一个类名为wp-tag-cloud的无序列表中
    • ‘array’ 标签保存在数值中

    orderby
    (字符) 标签的排序,有效值为:

    • ‘name’ (默认,名称)
    • ‘count’ 使用次数

    order
    (字符) 排序次序。有效值 – 必须大写:

    • ‘ASC’ (默认值,升序)
    • ‘DESC’ (降序)

    exclude
    (字符) 排除用逗号(半角)分隔的一列标签(term_id)。例如, ‘exclude=5,27′ 意味着term_id为5或27的标签将不会显示。默认不排除如何标签。
    include
    (字符) 包含用逗号(半角)分隔的一列标签。例如,’include=5,27′意味着只有term_id为5或者27的标签将显示。默认包含如何标签。

    创建标签档案文件

    2.3版本的重要特点是添加了标签功能,wp_tag_cloud标签可以用于显示一个标签存档。这也意味着访问者点击标签云图中的某个标签,他可以得到所有使用了这个标签的文章。根据Template_Hierarchy,如果tag.php模版不存在时,将使用archives.php模版。通过使用tag.php模版,你可以定制你的标签存档的样式,此模版在最上面包含了标签云图,起到了导航的作用。

    要把这个弄成一个新的模板的话,需要把这个加入到主题文件中去。(Template_Hierarchy里有关于模版的资源。)需要的步骤如下:

    • 1.将下面的内容保存到tag.php中。
    • 2.将该文件上传到主题文件夹中。
    • 3.当你希望在导航栏有个链接可到达标签存档中时,否则它只在点击某个标签后使用:增加一个使用tag.php的空白页面,并给它起名为标签存档。

    第三步的详细说明

    WordPress可以设置成不同的页面使用不同的页面模板。在管理面板“写作->页面”的底部(或在边栏,取决于你使用的wordpress版本)有个名为“Page Template(页面模板)”的下拉菜单。在那里,你可以选择使用哪个模板显示这个页面。

    1. <?php /*
    2. Template Name: Tag Archive
    3. */ ?>
    4. <div>
    5. <?php get_header(); ?>
    6. <h2>Tag Archive</h2>
    7. <?php wp_tag_cloud(); ?>
    8.     <div class=”navigation”>
    9. <div class=”alignleft”><?php next_posts_link(« Older Entries) ?></div>
    10. <div class=”alignright”><?php previous_posts_link(Newer Entries ») ?></div>
    11.     </div>
    12. <?php if (have_posts()) : ?>
    13.         <?php while (have_posts()) : the_post(); ?>
    14.         <h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>“><?php the_title(); ?></a></h2>
    15.     <div class=”entry”>
    16.     <?php the_content(Read the rest of this entry »); ?>
    17.     </div>
    18.  
    19.     <?php endwhile; ?>
    20.     <?php endif; ?>
    21. </div>
    22. <?php get_footer(); ?>

    请注意,这个模板没有添加任何样式,查看single.php可以得知确定的样式。

    英文原文:Template_Tags/wp_tag_cloud

    Tags: , , , , , ,
    2,827 Views | 四月 10th, 2008 | Permanent Link:wp_tag_cloud函数使用说明