Advertisement
bennyp

Untitled

Apr 9th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. add_action( 'init', 'the_debug_function' );
  4.  
  5.  
  6. // Shortcode for displaying children of a category in a horizontal list
  7.  
  8. function horizontal_category_func( $parent, $content = null ) {
  9.        
  10.     extract(shortcode_atts(array(
  11.         "parent" => 'ID'
  12.     ), $parent));
  13.    
  14.     $slug = $parent->slug;
  15.     $cat_name = get_the_category_by_ID( $parent );
  16.     $cat_title = "<h3><a href=\"category/$slug\">$cat_name</a></h3>";
  17.     $cat_list = wp_list_categories( "child_of=$parent&show_count=1&title_li=$cat_title" );
  18.    
  19.     return $cat_list;
  20. }
  21.  
  22. add_shortcode( 'horizontal_category', 'horizontal_category_func' );
  23.  
  24. function the_debug_function() { apply_filters( 'the_content', '<div id="horizontalcategories">[horizontal_categories parent="22"]</div>' ); exit();
  25. echo apply_filters;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement