View difference between Paste ID: jGsbE4jN and DfARjz1X
SHOW: | | - or go back to the newest paste.
1
<?php
2
add_action( 'wp', 'the_debug_function' );
3-
add_action( 'init', 'the_debug_function' );
3+
4
5
// Shortcode for displaying children of a category in a horizontal list
6
7
function horizontal_category_func( $parent, $content = null ) {
8
		
9
	extract(shortcode_atts(array(
10
		"parent" => 'ID'
11
	), $parent));
12
	
13
	$slug = $parent->slug;
14
	$cat_name = get_the_category_by_ID( $parent );
15
	$cat_title = "<h3><a href=\"category/$slug\">$cat_name</a></h3>";
16
	$cat_list = wp_list_categories( "child_of=$parent&show_count=1&title_li=$cat_title" );
17
	
18
	return $cat_list;
19
}
20
21
add_shortcode( 'horizontal_category', 'horizontal_category_func' );
22
23
function the_debug_function() { echo apply_filters( 'the_content', '<div id="horizontalcategories">[horizontal_categories parent="22"]</div>' ); exit(); }