Good for @Tom J Nowell♦ solution would be more properly. But it still could fulfill the goal which add the extra function in your class.
class List_Categories_Radiobuttons extends Walker_Category
{
function start_el(&$output, $category, $depth = 0, $args = array(), $current_object_id = 0)
{
$category_name = esc_attr($category->name);
$radiobutton = '<input class="form-check-input" type="checkbox" value="' . $category_name . '" id="flexCheckDefault' . $category_name . '"><label class="form-check-label" for="flexCheckDefault' . $category_name . '">' . $category_name . '</label>';
$output .= '<span class="form-check">' . $this->content_el() . '</span>';
}
function end_el(&$output, $category, $depth = 0, $args = array(), $current_object_id = 0)
{
$output .= '';
}
private function content_el()
{
$args = array(
'taxonomy' => 'pa_rozmiar',
'name' => 'pa_rozmiar',
'value_field' => 'slug',
'class' => 'd-none form-check',
'walker' => new List_Categories_Radiobuttons
);
wp_dropdown_categories($args);
}
}
The arguments is fixed so far.You could setup the argument and call the function when turn public. Then generate your $output
later when you call end_el
.There is more flexible is use DOMDocument
to add your document node, and it would be manipulate like JavaScript(or JQuery) and easily.