Hi. Can I ask what’s the name of bundle and tag taxonomy for Templates? I’d rather to change them to hierarchical so I can see the checkboxes
Or maybe you have a ready snippet for it. That will work too lol xD
Hi. Can I ask what’s the name of bundle and tag taxonomy for Templates? I’d rather to change them to hierarchical so I can see the checkboxes
Or maybe you have a ready snippet for it. That will work too lol xD
In case anyone arrives here:
template_tag - for tags
template_bundle - for the bundle tags
bricks_template - the CPT
If you’d prefer hierarchical tags and a filterable admin column - put this in a plugin/functions.php
add_action('restrict_manage_posts', 'ds_filter_post_type_by_taxonomy');
function ds_filter_post_type_by_taxonomy() {
global $typenow;
$post_type = 'bricks_template';
$taxonomy = 'template_bundle';
if ($typenow == $post_type) {
$selected = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
$info_taxonomy = get_taxonomy($taxonomy);
wp_dropdown_categories(array(
'show_option_all' => sprintf( __( 'Show all %s', 'textdomain' ), $info_taxonomy->label ),
'taxonomy' => $taxonomy,
'name' => $taxonomy,
'orderby' => 'name',
'selected' => $selected,
'show_count' => true,
'hide_empty' => true,
));
};
}
add_filter('parse_query', 'ds_convert_id_to_term_in_query');
function ds_convert_id_to_term_in_query($query) {
global $pagenow;
$post_type = 'bricks_template';
$taxonomy = 'template_bundle';
$q_vars = &$query->query_vars;
if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) {
$term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
$q_vars[$taxonomy] = $term->slug;
}
}