Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'init', 'the_debug_function' );
- // Shortcode for displaying children of a category in a horizontal list
- function horizontal_category_func( $parent, $content = null ) {
- extract(shortcode_atts(array(
- "parent" => 'ID'
- ), $parent));
- $slug = $parent->slug;
- $cat_name = get_the_category_by_ID( $parent );
- $cat_title = "<h3><a href=\"category/$slug\">$cat_name</a></h3>";
- $cat_list = wp_list_categories( "child_of=$parent&show_count=1&title_li=$cat_title" );
- return $cat_list;
- }
- add_shortcode( 'horizontal_category', 'horizontal_category_func' );
- function the_debug_function() { apply_filters( 'the_content', '<div id="horizontalcategories">[horizontal_categories parent="22"]</div>' ); exit();
- echo apply_filters;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement