<?php
class ListCategories{
static function list_categories($atts, $content = null) {
$atts = shortcode_atts(
array(
'orderby' => 'count',
'title_li' => __( '' )
), $atts
);
ob_start();
wp_list_categories($atts);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}
add_shortcode( 'categories', array('ListCategories', 'list_categories') );
?>
Add this code to your functions.php file or create a plugin.
Using the shortcode [categories], you can insert a list of all categories into a page or post.
Using the shortcode [categories], you can insert a list of all categories into a page or post.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.