View difference between Paste ID: u2FvVhSF and jGsbE4jN
SHOW: | | - or go back to the newest paste.
1
<?php
2
add_action( 'wp', '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-
		
8+
// debug to check if function is being called 
9
 exit("I've been hit!");
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-
function the_debug_function() { echo apply_filters( 'the_content', '<div id="horizontalcategories">[horizontal_categories parent="22"]</div>' ); exit(); }
23+
24
function the_debug_function() { echo apply_filters( 'the_content', '<div id="horizontalcategories">[horizontal_categories parent="22"]</div>' ); exit(); }
25
return;