php - List Post Categories Wordpress -
i want list of categories of wordpress posts in input so:
<input type="checkbox" class="something" id="[category-name]" value="[category-name] + ([amount of posts have category])" />
anyone can help me out, in advance!
you might want formatting output of get_categories()
:
$catlist = get_categories(); foreach ($cat in $catlist) { $tag = '<input type="checkbox" class="something" id="'; $tag .= $cat->name; $tag .= '" value="'; $tag .= $cat->name; $tag .= ' + ('; $tag .= $cat->count; $tag .= ')" />'; echo $tag; }
from wp codex: http://codex.wordpress.org/function_reference/get_categories#return_values
php wordpress
No comments:
Post a Comment