Last active
August 29, 2015 14:23
-
-
Save icetee/8b9a7aa3edc44a9daca9 to your computer and use it in GitHub Desktop.
get_custom_categories() in WordPress
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
function get_custom_categories($slug) { | |
$args = array( | |
'hide_empty' => 1, | |
'orderby' => 'name', | |
'show_count' => 0, | |
'pad_counts' => 0, | |
'hierarchical' => 1, | |
'taxonomy' => $slug, | |
'title_li' => '', | |
'style' => 'none', | |
'echo' => 0 | |
); | |
$cat = wp_list_categories($args); | |
preg_match_all("/<a.*?>(.*?)<\/a>/", $cat, $matches); | |
return $matches; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment