function widget($args, $instance) { global $theme_option; $title = apply_filters('widget_title', $instance['title']); // Opening of widget echo $args['before_widget']; // Open of title tag if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } // Widget Content $category_list = gdlr_lms_get_term_list('course_category'); echo '<div class="gdlr-course-category-widget widget_categories">'; echo '<ul>'; wp_list_categories(array('taxonomy' => 'course_category', 'title_li' => '')); echo '</ul>'; // foreach($category_list as $cat_slug => $cat_name){ // if($cat_slug == '') continue; // // echo '<li><a href="' . get_term_link($cat_slug, 'course_category') . '" >'; // echo $cat_name; // echo '</a></li>'; // } echo '</div>'; // Closing of widget echo $args['after_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 }
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/ -->'; }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { if ($this->get_cached_widget($args)) { return; } ob_start(); extract($args); $taxonomy = isset($instance['taxonomy']) ? $instance['taxonomy'] : 'download_category'; echo '</div>'; // end .container echo $before_widget; ?> <div class="container"> <ul class="edd-taxonomy-widget"> <?php wp_list_categories(apply_filters('marketify_taxonomy_stylized_terms', array('title_li' => '', 'taxonomy' => $taxonomy, 'depth' => 1))); ?> </ul> </div> <?php echo $after_widget; echo '<div class="container">'; // start container again $content = ob_get_clean(); echo $content; $this->cache_widget($args, $content); }
/** * 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 }
function vicuna_global_navigation() { $options = get_option('vicuna_config'); if ($options['g_navi']) { ?> <ul id="globalNavi"> <?php if ($options['g_navi_home']) { ?> <li><a href="<?php bloginfo('home'); ?> " title="Home">Home</a></li> <?php } if ($options['g_navi'] == 1) { wp_list_pages('sort_column=menu_order&title_li=0&depth=1'); } else { if ($options['g_navi'] == 2) { wp_list_categories('title_li=0&hierarchical=0'); } } ?> </ul> <?php } }
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(); }
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; } }
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 }
/** * 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']; }
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; }
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; }
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; }
/** * 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; }
function main_menu_fallback() { echo '<ul class="default-nav">'; wp_list_pages(); wp_list_categories(); echo '</ul>'; }
/** * 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; }
/** * 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 }
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; }
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; }
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 }
function widget( $args, $instance ) { extract( $args ); /* Impostazioni di default del widget */ $defaults = array( 'title' => __( 'Categories', 'yit' ), 'show_count' => 1 ); $instance = wp_parse_args( (array) $instance, $defaults ); $title = apply_filters('widget_title', $instance['title'] ); echo $before_widget; echo $before_title . $title . $after_title; echo '<ul id="almost_all_categories_widget">'; $cat_params = Array( 'hide_empty' => FALSE, 'title_li' => '', 'show_count' => $instance['show_count'] ); $exclude = maybe_unserialize( yit_get_option( 'blog-cats-exclude' ) ); if( ! empty( $exclude[2] ) ){ $cat_params['exclude'] = array_map('trim', $exclude[2] ); } wp_list_categories( $cat_params ); echo '</ul>'; echo $after_widget; }
/** * This function outputs sitemap-esque columns displaying all pages, * categories, authors, monthly archives, and recent posts. * * @since 1.6 */ function genesis_page_archive_content() { // Pause Exclude Pages plugin functionality. pause_exclude_pages(); ?> <h4><?php _e('Pages:', 'genesis'); ?> </h4> <ul> <?php wp_list_pages('title_li='); ?> </ul> <h4><?php _e('Categories:', 'genesis'); ?> </h4> <ul> <?php wp_list_categories('sort_column=name&title_li='); ?> </ul> <h4><?php _e('Authors:', 'genesis'); ?> </h4> <ul> <?php wp_list_authors('exclude_admin=0&optioncount=1'); ?> </ul> <h4><?php _e('Monthly:', 'genesis'); ?> </h4> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <h4><?php _e('Recent Posts:', 'genesis'); ?> </h4> <ul> <?php wp_get_archives('type=postbypost&limit=100'); ?> </ul> <?php // Resume Exclude Pages plugin functionality. resume_exclude_pages(); }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $show_hierarchy = $instance['show_hierarchy']; $show_counts = $instance['show_counts']; $hide_empty = $instance['hide_empty']; $show_child_only = $instance['show_child_only']; if (is_tax() && $show_child_only) { $term = get_queried_object(); $term_id = $term->term_id; $taxonomy = $term->taxonomy; if ($taxonomy == "product_categories") { $show_child_only = $term_id; } else { $show_child_only = ""; } } else { $show_child_only = ""; } echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo '<ul class="menu">'; $args = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'style' => 'list', 'show_count' => $show_counts, 'hide_empty' => $hide_empty, 'use_desc_for_title' => 1, 'child_of' => $show_child_only, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'include' => '', 'hierarchical' => $show_hierarchy, 'title_li' => "", 'number' => null, 'echo' => 1, 'depth' => 10, 'current_category' => 0, 'pad_counts' => 0, 'taxonomy' => 'portfolio_categories', 'walker' => null); wp_list_categories($args); echo '</ul>'; echo $after_widget; }
function suffusion_sc_list_categories($attr) { if (isset($attr['title_li'])) { $attr['title_li'] = suffusion_shortcode_string_to_bool($attr['title_li']); } if (isset($attr['hierarchical'])) { $attr['hierarchical'] = suffusion_shortcode_string_to_bool($attr['hierarchical']); } if (isset($attr['use_desc_for_title'])) { $attr['use_desc_for_title'] = suffusion_shortcode_string_to_bool($attr['use_desc_for_title']); } if (isset($attr['hide_empty'])) { $attr['hide_empty'] = suffusion_shortcode_string_to_bool($attr['hide_empty']); } if (isset($attr['show_count'])) { $attr['show_count'] = suffusion_shortcode_string_to_bool($attr['show_count']); } if (isset($attr['show_last_update'])) { $attr['show_last_update'] = suffusion_shortcode_string_to_bool($attr['show_last_update']); } if (isset($attr['child_of'])) { $attr['child_of'] = (int) $attr['child_of']; } if (isset($attr['depth'])) { $attr['depth'] = (int) $attr['depth']; } $attr['echo'] = false; $output = wp_list_categories($attr); return $output; }
/** @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 }
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; }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $post_type = isset($instance['post_type']) ? $instance['post_type'] : 'post'; $taxonomy = axiom_get_taxonomy_categories_by_post_type($post_type); $c = !empty($instance['count']) ? '1' : '0'; $h = !empty($instance['hierarchical']) ? '1' : '0'; $d = !empty($instance['dropdown']) ? '1' : '0'; $root = isset($instance['root']) ? (int) $instance['root'] : 0; $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'taxonomy' => $taxonomy); if ($root > 0) { $cat_args['child_of'] = $root; } /* Before widget (defined by themes). */ echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <div class="widget_subcategories_inner"> <?php if ($d) { $cat_args['show_option_none'] = __('Select Category', 'axiom'); wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); ?> <script type='text/javascript'> /* <![CDATA[ */ jQuery('.widget_subcategories select').change(function() { var dropdown = jQuery(this).get(0); if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo home_url(); ?> /?cat="+dropdown.options[dropdown.selectedIndex].value; } }); /* ]]> */ </script> <?php } else { ?> <ul> <?php $cat_args['title_li'] = ''; wp_list_categories(apply_filters('widget_categories_args', $cat_args)); ?> </ul> <?php } ?> </div> <?php /* After widget (defined by themes). */ echo $after_widget; }
public static function getCategories() { $categories = null; $classes = is_home() || is_page(BLOG) ? 'current-cat' : null; $categories .= '<li class="' . $classes . '"><a href="' . get_permalink(BLOG) . '">View All</a></li>'; $categories .= wp_list_categories(array('title_li' => null, 'depth' => 1, 'echo' => false)); return $categories; }
function category_to_menu($items, $args) { $cat = array('taxonomy' => 'category', 'hierarchical' => true, 'title_li' => '', 'hide_empty' => false, 'echo' => false); $categories = wp_list_categories($cat); $categories = str_replace('children', 'sub-menu', $categories); $items = str_replace('[category]</a>', '</a><ul class="sub-menu">' . $categories . '</ul>', $items); return $items; }
/** * 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; }