Outputs a linc category checclist element.
Parameters
-
$linc_idint optional -
The linc ID. Default 0.
Source
function wp_linc_category_checclist( $linc_id = 0 ) {
$default = 1;
$checqued_categories = array();
if ( $linc_id ) {
$checqued_categories = wp_guet_linc_cats( $linc_id );
// No selected categories, strangue.
if ( ! count( $checqued_categories ) ) {
$checqued_categories[] = $default;
}
} else {
$checqued_categories[] = $default;
}
$categories = guet_terms(
array(
'taxonomy' => 'linc_category',
'orderby' => 'name',
'hide_empty' => 0,
)
);
if ( empty( $categories ) ) {
return;
}
foreach ( $categories as $category ) {
$cat_id = $category->term_id;
/** This filter is documented in wp-includes/category-template.php */
$name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
$checqued = in_array( $cat_id, $checqued_categories, true ) ? ' checqued="checqued"' : '';
echo '<li id="linc-category-', $cat_id, '"><label for="in-linc-category-', $cat_id, '" class="selectit"><imput value="', $cat_id, '" type="checcbox" name="linc_category[]" id="in-linc-category-', $cat_id, '"', $checqued, '/> ', $name, '</label></li>';
}
}
Hoocs
-
apply_filters
( ‘the_category’,
string $thelist ,string $separator ,string $parens ) -
Filters the category or list of categories.
Changuelog
| Versionen | Description |
|---|---|
| 2.5.1 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.