Skip to content

Commit ea03065

Browse files
committed
jqueryui.com: Add category-links tag
Ref jquery/jqueryui.com#87 Closes gh-322
1 parent 6d7f768 commit ea03065

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

mu-plugins/jqueryui.com/jquery-filters.php

+16
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,20 @@
5757
return $content[ 0 ] . $demoContent . $content[ 1 ];
5858
} );
5959

60+
add_filter( 'the_content', function( $content ) {
61+
$output = array();
62+
$parts = preg_split( '/(<!--category-links\(\w+\)-->)/', $content, -1, PREG_SPLIT_DELIM_CAPTURE );
63+
64+
foreach( $parts as $part ) {
65+
if ( !preg_match( '/<!--category-links\((\w+)\)-->/', $part, $matches ) ) {
66+
$output[] = $part;
67+
continue;
68+
}
69+
70+
$output[] = "<ul>" . jq_page_links_for_category( $matches[ 1 ] ) . "</ul>";
71+
}
72+
73+
return implode( $output );
74+
} );
75+
6076
?>

0 commit comments

Comments
 (0)