I've recently discovered that we can insert a dropdown list of categories like this:
<?php
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
?>
<?php wp_dropdown_categories(array(
'child_of' => 0,
'class' => 'postform',
'depth' => 0,
'echo' => 1,
'exclude' => '',
'hide_empty' => false,
'hide_if_empty' => false,
'hierarchical' => true,
'id' => '',
'name' => 'cat-dropdown',
'order' => 'ASC',
'orderby' => 'name',
'selected' => 0,
'show_count' => 0,
'show_option_all' => '',
'show_option_none' => __('None'),
'tab_index' => 0,
'taxonomy' => 'format',
)); ?>
Which is great. BUT, what if I want to select multiple categories?
I've come across wp_category_checklist() and tried this code:
<?php function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
wp_terms_checklist( $post_id, array(
'taxonomy' => 'category',
'descendants_and_self' => $descendants_and_self,
'selected_cats' => $selected_cats,
'popular_cats' => $popular_cats,
'walker' => $walker,
'checked_ontop' => $checked_ontop
) );
} ?>
But it doesn't output anything.
I'm trying to get a list of my categories on a BLANK PAGE, not within a sidebar or post.
Is what I want possible?
wp_category_checklist()above is just the function definition. – RRikesh Jan 14 at 5:50