Shortcodes For Boostrap Collapsible

bs_full   bs_full1

[bs]

I like to use Bootstrap for my blogs, so I created a few shortcodes for collapsible and link buttons when I need to use them.

[mybs data=”1″ title=”this is title1″]1. Lorem ipsum dolor sit amet, consectetur adipisicing elit,[/mybs]

[mybs data=”2″ title=”this is title2″]2. Lorem ipsum dolor sit amet, consectetur adipisicing elit,[/mybs]

[mybs data=”3″ title=”this is title3″]3. Lorem ipsum dolor sit amet, consectetur adipisicing elit,[/mybs]

add_shortcode( ‘mybs’, ‘mybs_func’ );
function mybs_func($atts, $content = null) {
extract(shortcode_atts(array(
‘data’ => ”,
‘title’ =>”,
), $atts));
return
‘”< “button class=”btn btn-info” type=”button” data-toggle=”collapse” data-target=”‘.’#’.$atts[‘data’].'”>’.$atts[‘title’].”.

“< “div id=”‘.$atts[‘data’].'” class=”collapse”>’.$content.'< “/”div>

; }

add_shortcode( ‘bs’, ‘bsscript’ );
function bsscript() {
return


; }

include ‘bs_full.php’; in function.php
use shortcode [“bs] to load the bs scripts
use shortcode [“mybs data=”0″ title=”blahblah”]content[“/mybs]

Make button links with different color display.

technologies today

<a href=”//www.dognmonkey.com/techs”>[ bsblue]technologies today[/bsblue ]</a>

add_shortcode( ‘bsblue’, ‘bsbutton2’ );
function bsbutton2($atts, $content = null) {
extract(shortcode_atts(array(
‘data’ => ”,
), $atts));
return
‘<button type=”button” class=”btn btn-primary”>’.$content.'</button>’
; }

 

technologies today

<a href=”//www.dognmonkey.com/techs”>[ bsred]technologies today[/bsred ]</a>

add_shortcode( ‘bsred’, ‘bsbutton1’ );
function bsbutton1($atts, $content = null) {
extract(shortcode_atts(array(
‘data’ => ”,
), $atts));
return
‘<button type=”button” class=”btn btn-danger”>’.$content.'</button>’
; }

 

technologies today

<a href=”//www.dognmonkey.com/techs”>[ bsgreen]technologies today[/bsgreen ]</a>

add_shortcode( ‘bsgreen’, ‘bsbutton3’ );
function bsbutton3($atts, $content = null) {
extract(shortcode_atts(array(
‘data’ => ”,
), $atts));
return
‘<button type=”button” class=”btn btn-success”>’.$content.'</button>’
; }

Leave a Reply

Your email address will not be published. Required fields are marked *