How Do I Add Collapsible in WordPress?

Adding collapsible to your WordPress website is easy. All you need is the collapsible plugin and a few lines of code.

After installing the plugin, add the following code to your theme’s functions.php file:.

function my_collapsible() { global $collapse_settings; if($collapse_settings[‘show_on_front’] == ‘true’) { return; } $collapse_settings[‘show_on_front’] = false; } add_action(‘init’, ‘my_collapsible’);

Now you can use the collapse function to control how collapsible elements appear on your website. To enable collapsible content on a post or page, add the following line of code to the post or page’s header:

Once you have added the line of code, the collapsible element will appear only when the post or page is viewed in the front-end. To disable collapsible content on a post or page, simply remove the

line of code.