本文整理汇总了PHP中wp_list_cats函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_list_cats函数的具体用法?PHP wp_list_cats怎么用?PHP wp_list_cats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_list_cats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ss_menu_widget
function ss_menu_widget($args, $widget_args = 1)
{
extract($args, EXTR_SKIP);
if (is_numeric($widget_args)) {
$widget_args = array('number' => $widget_args);
}
$widget_args = wp_parse_args($widget_args, array('number' => -1));
extract($widget_args, EXTR_SKIP);
$options = get_option('ssMenu_widget_options');
if (!isset($options[$number])) {
return;
}
$title = $options[$number]['title'] != "" ? $options[$number]['title'] : "";
if (!empty($title)) {
echo $before_widget . $before_title . $title . $after_title;
}
if (method_exists('ssMenu', 'foldcats')) {
ssMenu::$add_ssmenu_script = true;
//switch on js loader
ssMenu::foldcats($number);
} else {
echo "<ul>\n";
wp_list_cats('sort_column=name&optioncount=1&hierarchical=0');
echo "</ul>\n";
}
echo $after_widget;
}
示例2: b_wp_categories_show
function b_wp_categories_show($options, $wp_num = "")
{
$block_style = $options[0] ? $options[0] : 0;
$with_count = $options[1] ? $options[1] : 0;
$sorting_key = $options[2] ? $options[2] : 'name';
$sorting_order = $options[3] ? $options[3] : 'asc';
global $wpdb, $siteurl, $wp_id, $wp_inblock, $user_cache, $cache_categories, $category_name, $cat;
$id = 1;
$use_cache = 1;
if ($wp_num == "") {
$wp_id = $wp_num;
$wp_inblock = 1;
require dirname(__FILE__) . '/../wp-config.php';
$wp_inblock = 0;
}
$cur_PATH = $_SERVER['SCRIPT_FILENAME'];
if (preg_match("/^" . preg_quote(XOOPS_ROOT_PATH . "/modules/wordpress" . $wp_num . "/", "/") . "/i", $cur_PATH)) {
$cat = array_key_exists('cat', $_GET) ? intval($_GET['cat']) : null;
$category_name = array_key_exists('category_name', $_GET) ? $_GET['category_name'] : '';
if ($category_name and $cat == 0) {
$category_name = preg_replace('|/+$|', '', $category_name);
$cat = $wpdb->get_var("SELECT cat_ID FROM {$wpdb->categories[$wp_id]} WHERE category_nicename='{$category_name}'");
}
}
if ($block_style == 0) {
// Simple Listing
ob_start();
block_style_get($wp_num);
echo "<ul class='wpBlockList'>\n";
wp_list_cats("sort_column={$sorting_key}&sorting_order={$sorting_order}&optioncount={$with_count}");
echo "</ul>\n";
$block['content'] = ob_get_contents();
ob_end_clean();
} else {
// Dropdown Listing
$file = "{$siteurl}/index.php";
$link = $file . '?cat=';
ob_start();
block_style_get($wp_num);
echo '<form name="listcatform' . $wp_num . '" action="">';
$select_str = '<select name="cat" onchange="window.location = (\'' . $link . '\'+document.forms.listcatform' . $wp_num . '.cat[document.forms.listcatform' . $wp_num . '.cat.selectedIndex].value);"> ';
dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count);
echo '</form>';
$block_str = ob_get_contents();
ob_end_clean();
$block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str);
}
return $block;
}
示例3: widget_blix_categories
function widget_blix_categories()
{
?>
<h2><em><?php
_e('Categories');
?>
</em></h2>
<ul class="categories">
<?php
wp_list_cats('sort_column=name');
?>
</ul>
<?php
}
示例4: category_block
function category_block($options)
{
$mydirname = empty($options[0]) ? 'xpress' : $options[0];
$this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_category.html' : trim($options[1]);
$show_option_all = empty($options[2]) ? '' : $options[2];
$orderby = empty($options[3]) ? 'name' : $options[3];
$order = empty($options[4]) ? 'ASC' : $options[4];
$show_last_updated = empty($options[5]) ? false : true;
$show_count = empty($options[6]) ? false : true;
$hide_empty = empty($options[7]) ? false : true;
$use_desc_for_title = empty($options[8]) ? false : true;
$exclude = empty($options[9]) ? '' : $options[9];
$includes = empty($options[10]) ? '' : $options[10];
$hierarchical = empty($options[11]) ? false : true;
$depth = !is_numeric($options[12]) ? 0 : $options[12];
if (function_exists('wp_list_categories')) {
$param = array('show_option_all' => $show_option_all, 'orderby' => $orderby, 'order' => $order, 'show_last_update' => $show_last_updated, 'style' => 'list', 'show_count' => $show_count, 'hide_empty' => $hide_empty, 'use_desc_for_title' => $use_desc_for_title, 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => $exclude, 'include' => $includes, 'hierarchical' => $hierarchical, 'title_li' => '', 'number' => '', 'echo' => 0, 'depth' => $depth);
if (xpress_is_wp_version('>=', '2.3')) {
$block['categories'] = wp_list_categories($param);
} else {
// not suport echo flag
ob_start();
wp_list_categories($param);
$block['categories'] = ob_get_contents();
ob_end_clean();
}
} else {
if (empty($show_option_all)) {
$optionall = 0;
} else {
$optionall = 1;
}
$param = array('optionall' => $optionall, 'all' => $show_option_all, 'sort_column' => $orderby, 'sort_order' => $order, 'show_last_update' => $show_last_updated, 'optioncount' => $show_count, 'hide_empty' => $hide_empty, 'use_desc_for_title' => $use_desc_for_title, 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => $exclude, 'hierarchical' => $hierarchical, 'recurse' => 1);
ob_start();
wp_list_cats($param);
$block['categories'] = ob_get_contents();
ob_end_clean();
}
return $block;
}
示例5: bloginfo
bloginfo('template_directory');
?>
/img/stl.gif" alt=""
width="15" height="15" class="corner"
style="display: none" />
</div>
<!-- POSTS BY CATEGORY -->
<h2><?php
_e('Categories');
?>
</h2>
<ul>
<?php
wp_list_cats();
?>
</ul>
<div class="sideitembottom">
<img src="<?php
bloginfo('template_directory');
?>
/img/sbl.gif" alt=""
width="15" height="15" class="corner"
style="display: none" />
</div>
</div><!-- end sideitem -->
示例6: get_settings
* @subpackage Grid_Focus
*/
?>
<div class="navStripWrapper">
<ul class="nav fix">
<li><a href="<?php
echo get_settings('home');
?>
/" title="Return to the the frontpage">Frontpage<br /><span>Return home</span></a></li>
<li><a id="triggerCatID2" href="#" title="Show categories">Browse<br /><span>By topic</span></a></li>
<li class="last"><a href="<?php
bloginfo('rss2_url');
?>
" title="Subscribe to the main feed via RSS">Subscribe<br /><span>RSS feed</span></a></li>
<li id="searchBar">
<?php
include TEMPLATEPATH . '/searchform.php';
?>
</li>
</ul>
<div id="footerStrip" class="toggleCategories fix" style="display: none;">
<ul class="fix">
<?php
wp_list_cats('sort_column=name&optioncount=0&exclude=10, 15');
?>
</ul>
</div>
</div>
示例7: wp_list_cats
<div id="obar">
<div class="sub-obar">
<ul>
<?php
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar(2)) {
?>
<li><h2>Categories</h2>
<ul>
<?php
wp_list_cats('sort_column=name&optioncount=0&children=0');
?>
</ul>
</li>
<li><h2><?php
_e('Archives');
?>
</h2>
<ul>
<?php
wp_get_archives('type=monthly');
?>
</ul>
</li>
<?php
wp_list_bookmarks();
}
?>
</ul>
示例8: _e
</div> <!-- [sb-about] -->
<div id="sidebar1">
<?php
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar(1)) {
?>
<h2><?php
_e('Categories');
?>
</h2>
<ul>
<li><?php
wp_list_cats('sort_column=name');
?>
</li>
</ul>
<h2>Feeds</h2>
<ul id="feed">
<li><a href="<?php
bloginfo('rss2_url');
?>
" rel="nofollow" title="<?php
_e('Subscribe to RSS');
?>
"><?php
_e('RSS Posts');
?>
示例9: the_ID
the_ID();
?>
" class="post single-post">
<h2 class="post-title-single"><?php
the_title();
?>
</h2>
<div class="post-entry">
<?php
the_content();
?>
<div style="clear:both;width:45%;padding:0 1em;float:left;">
<p style="margin-bottom:0;"><strong>Categories</strong></p>
<ul style="margin-top:0;">
<?php
wp_list_cats('sort_column=name&optioncount=1&feed=(Atom)&feed_image=' . get_bloginfo('template_url') . '/images/feed.png&hierarchical=1');
?>
</ul>
</div>
<div style="width:45%;padding:0 1em;float:left;">
<p style="margin-bottom:0;"><strong>Archives</strong></p>
<ul style="margin-top:0;">
<?php
wp_get_archives('type=monthly&show_post_count=1');
?>
</ul>
</div>
<div class="clearer"></div>
<?php
edit_post_link('Edit this entry.', '<p>', '</p>');
?>
示例10: wp_get_archives
</h3>
<ul class="archive-list">
<?php
wp_get_archives('show_post_count=1');
?>
</ul>
<br class="clear" />
<h3><?php
_e('Browse by Category', 'k2_domain');
?>
</h3>
<ul class="archive-list">
<?php
wp_list_cats('hierarchical=0&optioncount=1');
?>
</ul>
<br class="clear" />
</div> <!-- .entry-content -->
</div> <!-- #post-ID -->
</div> <!-- #current-content .hfeed -->
<div id="dynamic-content"></div>
</div> <!-- #primary -->
<?php
get_sidebar();
示例11: array_key_exists
?>
</ul>
</li>
<li class="sidebox">
<h3><?php
$child = array_key_exists('cat', $_REQUEST) ? '&child_of=' . $_REQUEST['cat'] : '';
_e($child ? 'Sub categories' : 'Categories', 'ml');
?>
</h3>
<ul>
<?php
if (function_exists('wp_list_categories')) {
wp_list_categories('show_count=1&depth=1&&hierarchical=1&title_li=' . $child);
} else {
wp_list_cats('optioncount=1');
}
?>
</ul>
</li>
<li class="sidebox">
<h3><?php
_e('Meta', 'ml');
?>
</h3>
<ul>
<?php
wp_register();
?>
<li><?php
wp_loginout();
示例12: _b_wp_categories_show
function _b_wp_categories_show($options, $wp_num = "")
{
$block_style = $options[0] ? $options[0] : 0;
$with_count = $options[1] ? $options[1] : 0;
$sorting_key = $options[2] ? $options[2] : 'name';
$sorting_order = $options[3] ? $options[3] : 'asc';
if (current_wp()) {
if (!empty($_SERVER['PATH_INFO'])) {
permlink_to_param();
}
init_param('GET', 'cat', 'string', '');
init_param('GET', 'category_name', 'string', '');
if (!empty($GLOBALS['category_name']) && empty($GLOBALS['cat'])) {
if (stristr($GLOBALS['category_name'], '/')) {
$GLOBALS['category_name'] = explode('/', $GLOBALS['category_name']);
if ($GLOBALS['category_name'][count($GLOBALS['category_name']) - 1]) {
$GLOBALS['category_name'] = $GLOBALS['category_name'][count($GLOBALS['category_name']) - 1];
// no trailing slash
} else {
$GLOBALS['category_name'] = $GLOBALS['category_name'][count($GLOBALS['category_name']) - 2];
// there was a trailling slash
}
}
$categoryHandler =& wp_handler('Category');
$categoryObject =& $categoryHandler->getByNiceName($GLOBALS['category_name']);
$GLOBALS['cat'] = $categoryObject->getVar('cat_ID');
}
}
if ($block_style == 0) {
// Simple Listing
ob_start();
block_style_get($wp_num);
echo '<ul class="wpBlockList">' . "\n";
wp_list_cats("hide_empty=0&sort_column={$sorting_key}&sorting_order={$sorting_order}&optioncount={$with_count}");
echo '</ul>' . "\n";
$block['content'] = ob_get_contents();
ob_end_clean();
} else {
// Dropdown Listing
$file = wp_siteurl() . '/index.php';
$link = $file . '?cat=';
ob_start();
block_style_get($wp_num);
echo '<form name="listcatform' . $wp_num . '" id="listcatform' . $wp_num . '" action="#">';
$select_str = '<select name="cat" onchange="window.location = (document.forms.listcatform' . $wp_num . '.cat[document.forms.listcatform' . $wp_num . '.cat.selectedIndex].value);"> ';
dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count, 0, false, 0, 0, true, 0, true, 0);
echo '</form>';
$block_str = ob_get_contents();
ob_end_clean();
$block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str);
}
return $block;
}
示例13: _e
<div id="widgets_archives_b" class="widget_set archive_group even">
<?php
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Archives_2')) {
?>
<div id="categories">
<h2><?php
_e("Categories", 'gluedideas_subtle');
?>
</h2>
<p><?php
_e('Find posts using the "tags" provided below.', 'gluedideas_subtle');
?>
</p>
<ul class="icon category">
<?php
wp_list_cats('hierarchical=0');
?>
</ul>
</div>
<?php
}
?>
</div>
</div>
<!-- Content End -->
<?php
get_footer();
示例14: _e
</div> <!-- /primary -->
<?php
}
}
?>
<div class="secondary">
<?php
if (get_tarski_option('show_categories')) {
?>
<h3><?php
_e('Category Archives', 'tarski');
?>
</h3>
<ul class="archivelist xoxo">
<?php
wp_list_cats('sort_column=name&sort_order=desc');
?>
</ul>
<?php
}
?>
<?php
th_sidebar();
?>
</div> <!-- /secondary -->
<?php
get_footer();
示例15: wp_list_pages
<?php
wp_list_pages('title_li=<h2>Pages</h2>');
?>
<li><h2>Archives</h2>
<ul>
<?php
wp_get_archives('type=monthly');
?>
</ul>
</li>
<li><h2>Categories</h2>
<ul>
<?php
wp_list_cats('sort_column=ID&optioncount=1&hierarchical=1');
?>
</ul>
</li>
<li>
<?php
ec3_get_calendar();
?>
</li>
<li><?php
_e('Next 5 Events');
?>
<?php
ec3_get_events(5);
?>