Add class to custom dynamic field

[ad_1]

Hello,

I made custom dynamic field to collect all my post type in checkboxes :

This is mycode :

function prefix_get_products_as_checkboxes_charges()

{

$options = array(); // Initialise le tableau des options

$prducts = get_posts(array(

    'post_type'      => 'mycpt',
    'posts_per_page' => -1,
    'orderby'        => 'title',
    'order'          => 'ASC',
    'tax_query'      => array(
        array(
            'taxonomy' => 'types',
            'field'    => 'term_id',
            'terms'    => '118',
        ),
    ),
));

if (is_array($prducts ) && count($prducts )) {
    foreach ($prducts  as $prducts ) {
        $options[$prducts->post_title] = $prducts->post_title;
    }
}
    return json_encode($options);
}

add_shortcode('liste', 'prefix_get_products_as_checkboxes_charges');

I wish to add a class to checkbox to my shortcode :

[dynamic_checkbox legeres “liste”]

What I have to add to my shortcode ?

Edit found my self: just add class:MYCLASS after “legeres”
I tried to add before, that was the problem

  • This topic was modified 7 minutes ago by Lust.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer