最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

widgets - Siderbar implementation with collapsible bootstrap cards

matteradmin9PV0评论

I'm trying to implement collapsible Bootstrap 4 cards on sidebar widgets, until now I have this:

register_sidebar(
        array(
            'name'          => esc_html__( 'New Sidebar', 'ns' ),
            'id'            => 'new_sidebar',
            'description'   => esc_html__( 'New Sidebar', 'ns' ),
            'before_widget' => '<div class="card">',
            'after_widget'  => '</div></div></div><br>',
            'before_title'  => '<h5 class="card-header mt-0"><a data-toggle="collapse" href="#collapse-example-%1$s" aria-expanded="true" aria-controls="collapse-example-%1$s" id="heading-example" class="d-block">
            <i class="fa fa-chevron-down float-right"></i>',
            'after_title'   => '</a></h5><div id="collapse-example-%1$s" class="collapse show" aria-labelledby="heading-example"><div class="card-body">',
        )
    );

The problem is that each collapsible container need an unique id to know which one open or close but my problem is in 'before_title' and 'after_title' because I'm not able to replace with the id. Anyone can help me with this?

Post a comment

comment list (0)

  1. No comments so far