
wordpress 分类插件——Category Icons
选用图片来识别不同分类,效果总比采用文字的好,难道不是吗~~
Category Icons就是这么一款插件,只要你调用分类函数,就会自动输出你所设置的分类图片。你也可以在想要显示分类图片的地方,输入代码来实现调用。同时一个分类可以设置好几个图片,可以在选定地方调用大图标或小图标。
在后台可以设置你所想选用的各个分类的不同图标。
插件作者的主页,国内似乎上不去,但试了一下用代理还是可以上的。
插件主要有两个基本调用函数:put_cat_icons() 和 get_cat_icon()。
1. put_cat_icons()
这个函数可以让你的sidebar实现分类图标化。
put_cat_icons(list [,get_cat_icon_parameters])
其中list : 指wp_list_categories() 这个函数。
Example :
例如在sidebar栏你可以如下这么写,可以在分类旁输出你选定的图片,记住一定要添加“echo=0”。
如果你加上‘icons_only=true’,则只有显示分类图片而不显示分类名称。
2. get_cat_icon()
这个函数可以在任何位置调用你选定的分类图片。
type, [default_value], parameter_name_to_use : description.
- string, align : align attribute for the image tag.
- boolean, border : If true the border will be displayed. If false, it’ll not. (Don’t use this if you want valid Strict XHTML)
- int, [current_category], cat : Category ID. If not specified, the current category is used or the current post’s category.
- string, class : Class attribute for the image tag.
- boolean, [true], echo : If true the html code will be ‘echoed’. If no, it’ll be returned.
- boolean, [false], expand : Whether the image should be expanded to fit the rectangle specified by fit_xxx.
- int, [-1], fit_height : Maximum height (or desired height if $expanded=true) of the image.
- int, [-1], fit_width : Maximum width (or desired width if $expanded=true) of the image.
- boolean, [false], hierarchical : If true, the icons are displayed in hierarchical order (horizontally).
- boolean, [true], link : If true the image is made a hyperlink (wrapped by anchor tag).
- int, [3], max_icons : Maximum number of icons to display
- string, prefix : String to echo before the image tag. If no image, no output.
- boolean, [true], small : Use the small icon.
- string, suffix : String to echo after the image tag. Ignored if no image found.
- boolean, [false], use_priority : If true, only the most prioritized icon will be displayed.
- boolean, [false], vertical_display : Display the icons vertically.
Examples
在你想调用的地方输入以下代码:
<?php get_cat_icon(); ?>
如果调用方式如上,则表示调用分类小图标,长宽分别为32px和20px,图片css类别名为"myicons"。从而你可以在"myicons"中设定图片显示位置。
如:
.myicons {
margin : 0 3px 0px 0;
}
如果调用方式如下,则表明在这里调用分类ID号为“5”的图片,长宽分别为100px和100px,如果图片偏小则自动拉大。
<?php get_cat_icon(‘cat=5&fit_width=100&height=100&expand=true’); ?>
插件作者主页:http://www.category-icons.com,需用代理。
延伸阅读:
- 不使用插件给分类添加图片 曾在wordpress...
- 自己进行WordPerss的SEO优化 也许你对所谓SEO不屑一顾,因为你觉得只是写给自己看的,不过简单的方法何不试一下? ...
- Creating Two-Tiered Conditional Navigation in Wordpress Here is...
- wordpress 各种图片相册插件 自从在JAY那闲逛后,就对如何轻松展示图片产生了浓厚的兴趣,毕竟比起文字,图片往往更能直接抓住某人的眼球~布鲁现在都是先上传到Yupoo,再贴图到文中,图片一多,感觉……快疯了~~ ...
- 你所需要了解的 WordPress 2.6 布鲁新安装了Wordpress 2.6后却发现,Windows...
Tagged: category icons, plugin, wordpress
See more on 互联网技巧




















.