Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wp_list_categories('use_desc_for_title=1');
- <ul id="category_list">
- <li><a href="#" title="3">Category C</a></li>
- <li><a href="#" title="1">Category A</a></li>
- <li><a href="#" title="2">Category B</a></li>
- </ul>
- $( document ).ready(
- function() {
- sort_list_recursive( $( '#category_list' ) );
- }
- );
- function sort_list_recursive( parent ) {
- var lst = parent.children( 'li' );
- lst.sort(
- function( a, b ) {
- var _a = a.getElementsByTagName( 'a' )[0].title;
- var _b = b.getElementsByTagName( 'a' )[0].title;
- return _a > _b ? 1 : -1;
- }
- ).appendTo( parent );
- lst.each( function() {
- $( this ).children( 'ul' ).each( function() {
- sort_list_recursive( $( this ) );
- });
- });
- }
- wp_list_categories('orderby=name');
- $terms = get_terms('my_taxonomy', 'hide_empty=0');
- foreach ( $terms as $term ) {
- ${$term->slug} = get_term_by('slug', $term->slug, 'product_cat');
- ${$term->slug.'_array'} = (array)${$term->slug};
- ${$term->slug.'_array_id'} =${$term->slug.'_array'}['term_id'];
- };
- $args = array(
- 'taxonomy' => 'my_taxonomy',
- 'orderby' => 'name',
- 'show_count' => true,
- 'pad_counts' => false,
- 'hierarchical' => true,
- 'title_li' => '',
- 'hide_empty' => 0,
- 'show_option_all' => 'Show all',
- 'exclude' => array( $term1_array_id, $term2_array_id )
- );
- $args_1 = array(
- 'taxonomy' => 'my_taxonomy',
- 'orderby' => 'name',
- 'show_count' => true,
- 'pad_counts' => false,
- 'hierarchical' => true,
- 'title_li' => '',
- 'hide_empty' => 0,
- 'exclude' => array( $term3_array_id, $term4_array_id, $term1_array_id )
- );
- $args_2 = array(
- 'taxonomy' => 'my_taxonomy',
- 'orderby' => 'name',
- 'show_count' => true,
- 'pad_counts' => false,
- 'hierarchical' => true,
- 'title_li' => '',
- 'hide_empty' => 0,
- 'exclude' => array( $term1_array_id, $term4_array_id, $term5_array_id )
- );
- <ul>
- <?php wp_list_categories( $args ); ?>
- <?php wp_list_categories( $args_1 ); ?>
- <?php wp_list_categories( $args_2 ); ?>
- </ul>
- $categories = get_categories( array(
- 'orderby' => 'description',
- 'order' => 'ASC'
- ) );
Add Comment
Please, Sign In to add comment