內容簡介
建立一個可放置於 WordPress 模板中的函數,用於類別雲,而不需要使用小工具或具有小工具準備功能的主題。
我在使用不具小工具準備功能的單欄主題後,創建了此外掛程式。我發現有多個外掛小工具可用,但沒有一個外掛可以讓我只需將 php 函數放入我的主題中即可顯示類別雲。
這個外掛的其他使用方式如下:
安裝 WP-Sticky 和 Exec-PHP。建立一個置頂貼文,在貼文中輸入此外掛程式的 php 代碼。現在您就擁有一個可以固定在網頁頂部的類別雲。
需求
WordPress 2.x
支援 PHP 的 Web 伺服器
升級
透過 WordPress 的「外掛程式」選單停用外掛程式
從 /wp-content/plugins/ 目錄中刪除以前的 no-widget-category-cloud 資料夾
將新的 no-widget-category-cloud 資料夾上傳至 /wp-content/plugins/ 目錄中
透過 WordPress 的「外掛程式」選單啟用外掛程式
使用方法
<?php nw_catcloud(small_size,big_size,size_unit,align,orderby,order,min_posts,hide_empty,title); ?>
small_size = 字體大小,整數 (預設 75)
big_size = 字體大小,整數 (預設 200)
size_unit = %、px、pt (預設 %)
align = left、right、center、justify (預設 left)
orderby = count、name (預設 name)
order = asc、desc (預設 asc)
min_posts = 最少文章數,整數 (預設 1)
hide_empty = 0、1 (預設 1,1=yes,0=no)
title = 字串 (此內容可以包含 HTML 程式碼以格式化標題)
在您想要加入類別雲的主題檔案 (index.php、single.php、page.php 等等) 中,以上述的形式新增一行程式碼。您也可以使用預設設定,即在括號中不指定任何內容。請見下面的範例 2。
享受您的成果。
如我在描述中所提到的,您也可以將此外掛程式與 Exec-PHP 一起使用,這將是一個不錯的組合。
範例
<?php nw_catcloud(75,200,'%','left','name','asc',1,1,'<h2 class="posttitle" style="margin-bottom:0px;">Categories</h2>'); ?>
<?php nw_catcloud(); ?>
待辦事項
我很樂意聆聽建議。
我相信我還會想到其他事情。
鳴謝
我必須公平地給予 Lee Kelleher 及他的 Category Cloud Widget 開發程式應有的認可。我在此陳述,我在此外掛程式中使用了他的許多程式碼,並在必要時對其進行修改,以使其達到我想要的功能。
外掛標籤
開發者團隊
原文外掛簡介
Creates a function that can be placed in a wordpress template for a category cloud that exists without the requirement of widgets or a widget ready theme.
I created this plugin after I started using a single column theme that is not widget ready. I found that there were multiple plugin widgets available, but no plugin that would allow me to just place a php function into my theme to display a category cloud.
Some ideas for oter uses of this plugin:
Install WP-Sticky and Exec-PHP. Create a Sticky post which will stay at the top of your page and type the php code for this plugin in the post. Now you have a Category Cloud that stays at the top of your page.
Requirements
WordPress 2.x
Web server that supports PHP
Upgrade
Deactivate the plugin through the ‘Plugins’ menu in WordPress
Delete the previous no-widget-category-cloud folder from the /wp-content/plugins/ directory
Upload the new no-widget-category-cloud folder to the /wp-content/plugins/ directory
Activate the plugin through the ‘Plugins’ menu in WordPress
Usage
small_size = font size, integer (default 75)
big_size = font size, integer (default 200)
size_unit = %, px, pt (default %)
align = left, right, center, justify (default left)
orderby = count, name (default name)
order = asc, desc (default asc)
min_posts = minimum number of posts, integer (default 1)
hide_empty = 0,1 (default 1, 1=yes,0=no)
title = string (This can contain HTML to format the title)
Open the theme files, in your favorite editor, that you wish to add the category cloud to (index.php, single.php, page.php, etc…).
Add a line that looks like above. You can also use the defaults by not specifiying anything between the parentheses. See example 2 below.
Enjoy.
As I mentioned in the description you can also use this plugin with Exec-PHP and it would make a nice combo with WP-Sticky.
Examples
Categories
'); ?>
To Do
I am open to suggestions.
I am sure I will think of something.
Credit
I’ve got to give credit where credit is due. And that credit goes to Lee Kelleher and his Category Cloud Widget. I used a lot of his code in this plugin modifying it where needed to make it work the way I wanted.
