Skip to content

Instantly share code, notes, and snippets.

@hunk
Last active May 16, 2016 19:26
Show Gist options
  • Save hunk/b93edf339e63fa18e7178be30f9c2682 to your computer and use it in GitHub Desktop.
Save hunk/b93edf339e63fa18e7178be30f9c2682 to your computer and use it in GitHub Desktop.
<?php
function callback_categories_function() {
global $post;
$categories = get_the_category();
$all = array();
foreach ($categories as $cat) {
$all[] = $cat->category_nicename;
}
return implode(",",$all);
}
function register_shortcodes(){
add_shortcode('show_categories', 'callback_categories_function');
}
add_action( 'init', 'register_shortcodes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment