Created
April 14, 2019 04:19
-
-
Save wbxpress/604f0bc0fecb16f03e5363c8eaa97d8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add Shortcode for category page | |
function list_categories($atts, $content = null) { | |
$atts = shortcode_atts( | |
array( | |
'show_option_all' => '', | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'style' => 'list', | |
'show_count' => 0, | |
'hide_empty' => 1, | |
'use_desc_for_title' => 1, | |
'child_of' => 0, | |
'feed' => '', | |
'feed_type' => '', | |
'feed_image' => '', | |
'exclude' => '', | |
'exclude_tree' => '', | |
'include' => '', | |
'hierarchical' => 1, | |
'title_li' => __( ' ' ), | |
'show_option_none' => __( 'No categories' ), | |
'number' => null, | |
'echo' => 1, | |
'depth' => 0, | |
'current_category' => 0, | |
'pad_counts' => 0, | |
'taxonomy' => 'category', | |
'walker' => null | |
), $atts | |
); | |
ob_start(); | |
wp_list_categories($atts); | |
$output = ob_get_contents(); | |
ob_end_clean(); | |
return $output; | |
} | |
add_shortcode( 'categories', 'list_categories'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment