wp_popular_terms_checklist example

if ( 0 > $parent ) {
        $parent = 0;
    }

    if ( 'category' === $taxonomy->name ) {
        $post_category = isset( $_POST['post_category'] ) ? (array) $_POST['post_category'] : array();
    } else {
        $post_category = ( isset( $_POST['tax_input'] ) && isset( $_POST['tax_input'][ $taxonomy->name ] ) ) ? (array) $_POST['tax_input'][ $taxonomy->name ] : array();
    }

    $checked_categories = array_map( 'absint', (array) $post_category );
    $popular_ids        = wp_popular_terms_checklist( $taxonomy->name, 0, 10, false );

    foreach ( $names as $cat_name ) {
        $cat_name          = trim( $cat_name );
        $category_nicename = sanitize_title( $cat_name );

        if ( '' === $category_nicename ) {
            continue;
        }

        $cat_id = wp_insert_term( $cat_name$taxonomy->name, array( 'parent' => $parent ) );

        
$tax_name    = esc_attr( $parsed_args['taxonomy'] );
    $taxonomy    = get_taxonomy( $parsed_args['taxonomy'] );
    ?> <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php echo esc_html( $taxonomy->labels->most_used ); ?></a></li> </ul> <div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;"> <ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" > <?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?> </ul> </div> <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> <?php             $name = ( 'category' === $tax_name ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
            // Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks.             echo "<input type='hidden' name='{$name}[]' value='0' />";
            ?> <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> <?php
Home | Imprint | This part of the site doesn't use cookies.