• Resolved Lust

    (@inumedia)


    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 1 year, 4 months ago by Lust.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add class to custom dynamic field’ is closed to new replies.