Add icon to collapse link
-
I want to add an icon to the collapse link. I am using Font Awesome. I figured out how to get it in there and look the way I want it, but obviously editing a plugin’s files directly is a bad idea.
I was wondering if there was a way to include some code in my child theme’s functions.php to add it, and keep it through plugin updates.Here is the code in the plugin that I want to alter:
function bc_collapse($atts, $content = null) { extract(shortcode_atts(array( 'id' => '', 'title' => '', 'open'=>'n' ), $atts)); if(empty($id)) $id = 'accordian_item_'.rand(100,999); $output = '<div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#'.$id.'">'.$title.' <i class="icon-collapse right bootstrap-collapse-icon"></i> </div> <div id="'.$id.'" class="accordion-body collapse '.($open == 'y' ? 'in' :'').'"> <div class="accordion-inner">'.$content.'</div> </div> </div>'; return $output; }
As you can see, I simply added
<i class="icon-collapse right bootstrap-collapse-icon"></i>
to the accordion-toggle link.
Here is an image of the result: https://i.imgur.com/UIV1YQl.png
Thanks,
Jake
- The topic ‘Add icon to collapse link’ is closed to new replies.