• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_list_categories函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_list_categories函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_list_categories函数的具体用法?PHP wp_list_categories怎么用?PHP wp_list_categories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_list_categories函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: widget

 /**
  * Outputs the widget based on the arguments input through the widget controls.
  *
  * @since 0.6.0
  */
 function widget($sidebar, $instance)
 {
     extract($sidebar);
     /* Set the $args for wp_list_categories() to the $instance array. */
     $args = $instance;
     /* Set the $title_li and $echo arguments to false. */
     $args['title_li'] = false;
     $args['echo'] = false;
     /* Output the theme's widget wrapper. */
     echo $before_widget;
     /* If a title was input by the user, display it. */
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     /* Get the categories list. */
     $categories = str_replace(array("\r", "\n", "\t"), '', wp_list_categories($args));
     /* If 'list' is the user-selected style, wrap the categories in an unordered list. */
     if ('list' == $args['style']) {
         $categories = '<ul class="xoxo categories">' . $categories . '</ul><!-- .xoxo .categories -->';
     }
     /* Output the categories list. */
     echo $categories;
     /* Close the theme's widget wrapper. */
     echo $after_widget;
 }
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:30,代码来源:widget-categories.php


示例2: show_category_rss_for_all_cats

function show_category_rss_for_all_cats()
{
    $rss_image = CAT_SPEC_RSS_URL . '/rss_small_icon.png';
    $output = '<div id="cat_specific_rss">';
    if (get_option('cat_rss_show_image_on_left') == '1') {
        $output .= '<ul>';
        $customcats = get_categories();
        foreach ($customcats as $customcat) {
            $customcatlist .= '<li><a title="Subscribe to the ' . $customcat->name . ' feed" href="' . get_bloginfo('url') . '/category/' . $customcat->category_nicename . '/feed/"><img src="' . $rss_image . '" alt="feed" /></a><a href="' . get_bloginfo('url') . '/category/' . $customcat->category_nicename . '">' . $customcat->name . '</a>';
            //$customcatlist .= '<li><a title="Subscribe to the '.$customcat->name.' feed" href="'.get_bloginfo('url').'/category/'.$customcat->category_nicename.'/feed/"><img src="'.$rss_image.'" alt="feed" /></a><a href="'.get_bloginfo('url').'/category/'.$customcat->category_nicename.'/feed/">'.$customcat->name.'</a>';
            if (get_option('cat_rss_show_post_count') == '1') {
                $customcatlist .= ' (' . $customcat->count . ')';
            }
            $customcatlist .= '</li>';
        }
        $output .= $customcatlist;
        $output .= '</ul>';
    } else {
        $output .= '<ul>';
        if (get_option('cat_rss_show_post_count') == '1') {
            $output .= wp_list_categories('orderby=name&show_count=1&feed_image=' . $rss_image . '&title_li=');
        } else {
            $output .= wp_list_categories('orderby=name&feed_image=' . $rss_image . '&title_li=');
        }
        $output .= '</ul>';
    }
    $output .= '</div>';
    return $output;
}
开发者ID:paarthd,项目名称:gslvpa,代码行数:29,代码来源:category-specific-rss-wp.php


示例3: widget

    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = $instance['title'];
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Latest tweets', 'framework') : $instance['title'], $instance, $this->id_base);
        $categ_parent = $instance['parent_category'];
        $categ_parent_id = get_cat_id(htmlentities($categ_parent));
        echo $before_widget;
        ?>

	    <?php 
        echo $before_title . $title . $after_title;
        ?>

		<?php 
        $categ_args = array('child_of' => $categ_parent_id, 'title_li' => '', 'show_option_none' => __('<p class="textwidget">No child categories that belong to the parent category you\'ve selected were found.</p>', 'framework'));
        ?>
    
    
		<ul>
			<?php 
        wp_list_categories($categ_args);
        ?>
        </ul>
    
            <?php 
        echo $after_widget;
        ?>
            
        <?php 
    }
开发者ID:robasaad,项目名称:hadi,代码行数:32,代码来源:widget_blog_cat.php


示例4: taxonomies_shortcode

 public static function taxonomies_shortcode($atts)
 {
     $defaults = array('orderby' => 'name', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'exclude' => '', 'exclude_tree' => '', 'include' => '', 'hierarchical' => 1, 'number' => null, 'depth' => 0, 'taxonomy' => 'category');
     extract(shortcode_atts($defaults, $atts));
     $categories_args = array('show_option_all' => '', 'orderby' => $orderby, 'order' => $order, 'style' => 'list', 'show_count' => $show_count, 'hide_empty' => $hide_empty, 'use_desc_for_title' => $use_desc_for_title, 'child_of' => $child_of, 'exclude' => $exclude, 'exclude_tree' => $exclude_tree, 'include' => $include, 'hierarchical' => $hierarchical, 'title_li' => '', 'number' => $number, 'echo' => 0, 'depth' => $depth, 'taxonomy' => $taxonomy);
     return '<ul>' . "\n" . wp_list_categories($categories_args) . '</ul>' . "\n" . '<!-- Powered by Extra Shortcodes wordpress.org/plugins/extra-shortcodes/ -->';
 }
开发者ID:webvitalii,项目名称:extra-shortcodes,代码行数:7,代码来源:extra-shortcodes.php


示例5: widget

    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        extract($args);
        $title = $instance['title'];
        ?>
       
       <aside class="media">
		<h3><?php 
        echo esc_html($title);
        ?>
</h3>
		<ul class="archives">
			
			<?php 
        $cat_args['title_li'] = '';
        $cat_args['exclude'] = '1';
        $cat_args['show_count'] = '1';
        /**
         * Filter the arguments for the Categories widget.
         *
         * @since 2.8.0
         *
         * @param array $cat_args An array of Categories widget options.
         */
        wp_list_categories(apply_filters('widget_categories_args', $cat_args));
        ?>

		</ul>
	</aside>

        <?php 
    }
开发者ID:Angelpm28,项目名称:ong-canada,代码行数:40,代码来源:category-widget.php


示例6: cp_ad_cats_widget

function cp_ad_cats_widget()
{
    ?>
    <div class="shadowblock_out">

        <div class="shadowblock">

            <h2 class="dotted"><?php 
    _e('Ad Categories', 'appthemes');
    ?>
</h2>

            <div class="recordfromblog">

                <ul>
                    <?php 
    wp_list_categories('orderby=name&order=asc&hierarchical=1&show_count=1&use_desc_for_title=0&hide_empty=0&depth=1&number=&title_li=&taxonomy=' . APP_TAX_CAT);
    ?>
                </ul>

            </div><!-- /recordfromblog -->

        </div><!-- /shadowblock -->

    </div><!-- /shadowblock_out -->

<?php 
}
开发者ID:joaosigno,项目名称:dazake-job,代码行数:28,代码来源:theme-widgets.php


示例7: widget

 public function widget($args, $instance)
 {
     if (!function_exists('get_sitewide_tags_option')) {
         return;
     }
     extract($args);
     $tags_blog_id = get_sitewide_tags_option('tags_blog_id');
     switch_to_blog($tags_blog_id);
     $title = 'Default Categories';
     $c = !empty($instance['count']) ? '1' : '0';
     $h = !empty($instance['hierarchical']) ? '1' : '0';
     $d = !empty($instance['dropdown']) ? '1' : '0';
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
     echo '<ul>';
     $cat_args['title_li'] = '';
     // We need to filter the category links, but only right here
     add_filter('term_link', array($this, 'filter_term_link'), 10, 3);
     add_filter('get_terms', array($this, 'filter_get_terms'), 10, 3);
     wp_list_categories(apply_filters('widget_categories_args', $cat_args));
     remove_filter('term_link', array($this, 'filter_term_link'), 10, 3);
     remove_filter('get_terms', array($this, 'filter_get_terms'), 10, 3);
     echo '</ul>';
     echo $after_widget;
     restore_current_blog();
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:29,代码来源:widgets.php


示例8: widget

    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $category_id = empty($instance['category_id']) ? 1 : $instance['category_id'];
        $use_cat_title = empty($instance['use_cat_title']) ? 0 : $instance['use_cat_title'];
        $hide_empty_cats = empty($instance['hide_empty_cats']) ? 0 : $instance['hide_empty_cats'];
        $show_post_count = empty($instance['show_post_count']) ? 0 : $instance['show_post_count'];
        $title_link = empty($instance['title_link']) ? 0 : $instance['title_link'];
        $excluded = empty($instance['excluded']) ? '' : $instance['excluded'];
        $sub_subs = empty($instance['sub_subs']) ? 0 : $instance['sub_subs'];
        $dropdown = empty($instance['dropdown']) ? 0 : $instance['dropdown'];
        $post_is_parent = empty($instance['post_is_parent']) ? 0 : $instance['post_is_parent'];
        $dropdown_text = empty($instance['dropdown_text']) ? __('Select Sub-category', 'sub-categories-widget') : $instance['dropdown_text'];
        $list_order = empty($instance['list_order']) ? 0 : $instance['list_order'];
        if ($post_is_parent) {
            $category = get_the_category();
            $category_id = $category ? $category[0]->cat_ID : 1;
        }
        if ($use_cat_title) {
            $title = apply_filters('widget_title', get_cat_name($category_id), $instance, $this->id_base);
        } else {
            $title = apply_filters('widget_title', empty($instance['title']) ? __('Sub Categories', 'sub-categories-widget') : $instance['title'], $instance, $this->id_base);
        }
        $parent = $sub_subs == 1 ? 'child_of' : 'parent';
        $order = $list_order == 1 ? 'DESC' : 'ASC';
        $no_sub_text = '<p>' . __('No sub-categories', 'sub-categories-widget') . '</p>';
        $subs = wp_list_categories(array($parent => $category_id, 'hide_empty' => $hide_empty_cats, 'show_count' => $show_post_count, 'exclude' => $excluded, 'title_li' => null, 'show_option_none' => '', 'echo' => 0, 'orderby' => 'ID', 'order' => $order));
        if ($post_is_parent == 0 || $post_is_parent == 1 && !empty($subs)) {
            echo $before_widget;
            if ($title_link) {
                echo $before_title . '<a href="' . get_category_link($category_id) . '">' . $title . '</a>' . $after_title;
            } else {
                echo $before_title . $title . $after_title;
            }
            if ($dropdown == 0) {
                if (!empty($subs)) {
                    echo '<ul>' . $subs . '</ul>';
                } else {
                    echo $no_sub_text;
                }
            } else {
                $subs = wp_dropdown_categories(array('id' => 'sub-cat-' . $this->number, 'show_option_none' => $dropdown_text, $parent => $category_id, 'hide_empty' => $hide_empty_cats, 'show_count' => $show_post_count, 'exclude' => $excluded, 'hide_if_empty' => true, 'echo' => false, 'orderby' => 'ID', 'order' => $order));
                if (!empty($subs)) {
                    echo $subs;
                    echo '<script type="text/javascript">
						/* <![CDATA[ */
						var dropdown' . $this->number . ' = document.getElementById("sub-cat-' . $this->number . '");
						function onSubCatChange() {
						if (dropdown' . $this->number . '.options[dropdown' . $this->number . '.selectedIndex].value > 0) { location.href = "' . get_option('home') . '?cat="+dropdown' . $this->number . '.options[dropdown' . $this->number . '.selectedIndex].value; }
						}
						dropdown' . $this->number . '.onchange = onSubCatChange;
						/* ]]> */
						</script>';
                } else {
                    echo $no_sub_text;
                }
            }
            echo $after_widget;
        }
    }
开发者ID:phongvan212,项目名称:kinhte,代码行数:60,代码来源:sub-categories-widget.php


示例9: childtheme_menus

function childtheme_menus()
{
    ?>
        <div id="page-menu" class="menu">
            <ul id="page-nav" class="sf-menu">
                <li class="rss"><a href="<?php 
    bloginfo('rss2_url');
    ?>
">RSS Feed</a></li>
                <?php 
    wp_list_pages('title_li=');
    ?>
            </ul>
        </div>
        <div id="category-menu" class="menu">
            <ul id="category-nav" class="sf-menu">
                <li class="home"><a href="<?php 
    bloginfo('url');
    ?>
">Home</a></li>
                <?php 
    wp_list_categories('title_li=&number=7');
    ?>
                <li class="blog-description"><span><?php 
    bloginfo('description');
    ?>
</span></li>
            </ul>
        </div>
<?php 
}
开发者ID:Aliciakwan,项目名称:OneCollection,代码行数:31,代码来源:functions.php


示例10: vd_root_categories

/**
 * Root categories widget
 */
function vd_root_categories($args)
{
    echo $args['before_widget'];
    printf("%s%s%s", $args['before_title'], "Categories", $args['after_title']);
    printf("<ul>%s</ul>", wp_list_categories('title_li=&depth=1'));
    echo $args['after_widget'];
}
开发者ID:svandragt,项目名称:wordpress-vandragt,代码行数:10,代码来源:functions.widgets.php


示例11: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $Num = apply_filters('$Num', $instance['Num']);
        if (!empty($instance['title'])) {
            //TEMISI BOSH QALDURULSA  'رەڭدار خەتكۈشلەر'  BOLUP KORINIDU
            $title = $instance['title'];
        } else {
            $title = 'سەھىپىلەر';
        }
        if (!empty($instance['Num'])) {
            $Num = $instance['Num'];
        } else {
            $Num = '10';
        }
        $title = apply_filters('widget_title', $title, $instance, $this->id_base);
        $Num = apply_filters('$Num', $Num, $instance, $this->id_base);
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
          <ul class="sehipe">
<?php 
        wp_list_categories('title_li=&depth=1');
        ?>
</ul>
		<?php 
        echo $after_widget;
    }
开发者ID:MenZil-Team,项目名称:gulzar,代码行数:31,代码来源:sehipe.php


示例12: bfa_hor_cats

function bfa_hor_cats($sort_order = "ID", $order = "ASC", $levels = "", $titles = "No", $exclude = "")
{
    // allow option "order" only if Plugin "My category Order" is activated:
    if (!function_exists('mycategoryorder') and $sort_order == 'order') {
        $sort_order = "ID";
    }
    $list_cat_string = wp_list_categories('orderby=' . $sort_order . '&order=' . $order . '&title_li=&depth=' . $levels . '&exclude=' . trim(str_replace(" ", "", $exclude)) . '&echo=0');
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t\t\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t\t\t<ul class='children'>/i", "<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">", $list_cat_string);
    # Added in 3.2.1: Option to add Category Description to menu bar link text
    global $bfa_ata;
    if ($bfa_ata['add_descr_cat_menu_links'] == "Yes") {
        $list_cat_string = preg_replace_callback("| title=\"(.*?)\">(.*?)</a>|", "bfa_add_descr_cat_menu_links", $list_cat_string);
    }
    if ($titles == "No") {
        $list_cat_string = preg_replace("/title=\"(.*?)\"/si", "", $list_cat_string);
    }
    return $list_cat_string;
}
开发者ID:aagivecamp,项目名称:FlintRiver,代码行数:27,代码来源:bfa_hor_cats.php


示例13: shortcode_mc_vertical_menu

    function shortcode_mc_vertical_menu($atts)
    {
        $vertical_menu = '';
        extract(shortcode_atts(array('title' => __('All Departments', 'media_center'), 'icon_class' => 'fa-list', 'menu' => '', 'el_class' => '', 'dropdown_trigger' => 'click', 'dropdown_animation' => 'none'), $atts));
        $element = 'mc_vertical_menu';
        $extra_class = trim($element . ' ' . $el_class);
        if (empty($menu)) {
            $side_menu = wp_list_categories(array('container' => false, 'menu_class' => 'nav', 'echo' => false, 'taxonomy' => 'product_cat', 'title_li' => '', 'hide_empty' => 0, 'walker' => new wp_bootstrap_categorieswalker(), 'dropdown_animation' => $dropdown_animation, 'dropdown_trigger' => $dropdown_trigger));
            $side_menu = str_replace('children', 'dropdown-submenu', $side_menu);
            $side_menu = '<ul class="nav">' . $side_menu . '</ul>';
        } else {
            $side_menu = wp_nav_menu(array('menu' => $menu, 'container' => false, 'menu_class' => 'nav', 'walker' => new wp_bootstrap_navwalker(), 'echo' => false, 'dropdown_animation' => $dropdown_animation, 'dropdown_trigger' => $dropdown_trigger));
        }
        $sidemenu_holder_class = 'sidemenu-holder';
        if ($dropdown_animation != 'none') {
            $sidemenu_holder_class .= ' animate-dropdown';
            $custom_css = '.sidemenu-holder .open > .dropdown-menu,
			.sidemenu-holder .open > .dropdown-menu > .dropdown-submenu > .dropdown-menu {
				animation-name: ' . $dropdown_animation . '; 
			}';
            $vertical_menu .= '<style type="text/css">' . $custom_css . '</style>';
        }
        $vertical_menu .= '<div class="' . $sidemenu_holder_class . '">';
        $vertical_menu .= "\t" . '<div class="side-menu">';
        $vertical_menu .= "\t\t" . '<div class="head">';
        $vertical_menu .= "\t\t\t" . '<i class="fa ' . $icon_class . '"></i> ' . $title;
        $vertical_menu .= "\t\t" . '</div>';
        $vertical_menu .= "\t\t" . '<nav class="yamm megamenu-horizontal" role="navigation">';
        $vertical_menu .= "\t\t\t" . $side_menu;
        $vertical_menu .= "\t\t" . '</nav>';
        $vertical_menu .= "\t" . '</div>';
        $vertical_menu .= '</div>';
        $vertical_menu = '<div class="' . $extra_class . '">' . $vertical_menu . '</div>';
        return $vertical_menu;
    }
开发者ID:Qualitair,项目名称:ecommerce,代码行数:35,代码来源:shortcode_mc_vertical_menu.php


示例14: widget

 /**
  * Echo the widget content.
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     extract($args);
     /** Merge with defaults */
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     if ($instance['title']) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     echo '<ul class="nav menu">' . "\n";
     // Empty fallback (default)
     if (empty($instance['include'])) {
         $categories = get_categories('hide_empty=0');
         foreach ((array) $categories as $category) {
             $instance['include'][] = $category->cat_ID;
         }
     }
     // Show Home Link?
     if (in_array('home', (array) $instance['include'])) {
         $active = is_front_page() ? 'class="current_page_item"' : '';
         echo '<li ' . $active . '><a href="' . trailingslashit(home_url()) . '">' . __('Home', 'genesis') . '</a></li>';
     }
     // Show Category Links?
     wp_list_categories(array('title_li' => '', 'include' => implode(',', (array) $instance['include']), 'orderby' => $instance['order'], 'hide_empty' => false));
     echo '</ul>' . "\n";
     echo $after_widget;
 }
开发者ID:hscale,项目名称:webento,代码行数:33,代码来源:menu-categories-widget.php


示例15: main_menu_fallback

function main_menu_fallback()
{
    echo '<ul class="default-nav">';
    wp_list_pages();
    wp_list_categories();
    echo '</ul>';
}
开发者ID:arildoosilva,项目名称:besm_restricted_area,代码行数:7,代码来源:navigation.php


示例16: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  * @since 1.0.0
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 function widget($args, $instance)
 {
     // Extract args
     extract($args, EXTR_SKIP);
     $category_id = empty($instance['category_id']) ? 1 : $instance['category_id'];
     $use_cat_title = empty($instance['use_cat_title']) ? 0 : $instance['use_cat_title'];
     $hide_empty_cats = empty($instance['hide_empty_cats']) ? 0 : $instance['hide_empty_cats'];
     $show_post_count = empty($instance['show_post_count']) ? 0 : $instance['show_post_count'];
     $title_link = empty($instance['title_link']) ? 0 : $instance['title_link'];
     if ($use_cat_title) {
         $title = apply_filters('widget_title', get_cat_name($category_id), $instance, $this->id_base);
     } else {
         $title = apply_filters('widget_title', empty($instance['title']) ? __('Sub Categories', 'wpsp') : $instance['title'], $instance, $this->id_base);
     }
     $no_sub_text = '<p>' . __('No sub-categories', 'wpsp') . '</p>';
     $subs = wp_list_categories(array('child_of' => $category_id, 'hide_empty' => $hide_empty_cats, 'show_count' => $show_post_count, 'title_li' => null, 'show_option_none' => '', 'echo' => 0));
     echo $before_widget;
     if ($title_link) {
         echo $before_title . '<a href="' . get_category_link($category_id) . '">' . $title . '</a>' . $after_title;
     } else {
         echo $before_title . $title . $after_title;
     }
     if (!empty($subs)) {
         echo '<ul>' . $subs . '</ul>';
     } else {
         echo $no_sub_text;
     }
     echo $after_widget;
     return $instance;
 }
开发者ID:sptheme,项目名称:klahan9,代码行数:39,代码来源:sub-categories-widget.php


示例17: default_menu

/**
 * A default menu for when they don't have one set.
 * Everybody sees a page list + the admins see a message about setting up the
 * menus in admin
 */
function default_menu()
{
    ?>

    <ul id="menu-main" class="menu--main  menu  cf">
        <?php 
    if (is_user_logged_in() && current_user_can('level_10')) {
        ?>
            <li><a href="<?php 
        bloginfo('url');
        ?>
/wp-admin/nav-menus.php"><?php 
        _e('Admin, não se esqueça de configurar um menu', 'cultural');
        ?>
</a></li>
        <?php 
    }
    ?>
        <?php 
    wp_list_pages('title_li=');
    ?>
        <?php 
    wp_list_categories('title_li=');
    ?>
    </ul>

    <?php 
}
开发者ID:centroculturalsp,项目名称:cultural,代码行数:33,代码来源:extras.php


示例18: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
        ?>

<div class="right-box">
								<div class="right-box-title">
									<h2><?php 
        echo $title;
        ?>
</h2>
								</div>
								<div class="right-box-content">
								<?php 
        $orderby = 'name';
        $taxonomy = 'study-area';
        $tittle = '';
        $args = array('orderby' => $orderby, 'taxonomy' => $taxonomy, 'title_li' => $tittle);
        ?>
									<ul>
										<?php 
        wp_list_categories($args);
        ?>
									</ul>
								</div>
								</div>
<?php 
        //echo $after_widget;
    }
开发者ID:bhakhri,项目名称:xandc,代码行数:30,代码来源:wiget-degrees-list.php


示例19: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        /* Our variables from the widget settings. */
        $number = $instance['number'];
        $hierarchical = $instance['hierarchical'];
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Display Widget */
        ?>
 
        <?php 
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
                  <ul>          
               <?php 
        if ($hierarchical == true) {
            $args = array('hierarchical' => 1, 'title_li' => '', 'taxonomy' => 'st_kb_category');
        } else {
            $args = array('hierarchical' => 0, 'title_li' => '', 'taxonomy' => 'st_kb_category');
        }
        wp_list_categories($args);
        ?>
		</ul>
		<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }
开发者ID:philtrimble,项目名称:GCFB-Portal-Theme---Main,代码行数:32,代码来源:widget-kb-categories.php


示例20: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = $instance['title'];
        $taxonomy = $instance['widgettaxonomy'];
        if ($taxonomy == '') {
            $taxonomy = 'category';
        }
        ?>
		<?php 
        echo $before_widget;
        ?>
        <?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        } else {
            echo $before_title . __('List Taxonomies', 'colabsthemes') . $after_title;
        }
        ?>
        <?php 
        echo '<ul>';
        wp_list_categories('taxonomy=' . $taxonomy . '&title_li=');
        echo '</ul>';
        ?>
		<?php 
        echo $after_widget;
        ?>
   
   <?php 
    }
开发者ID:aguerojahannes,项目名称:aguerojahannes.com,代码行数:30,代码来源:widget-colabs-list-taxonomy.php



注:本文中的wp_list_categories函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_list_cats函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_list_bookmarks函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap