Bootstrap Shortcodes for WordPress - Version 3.3.4

Version Description

  • Restore Bootstrap 3.2 backwards compatibility for [media-object] shortcode, updated documentation to use Bootstrap 3.3 example, but offer 3.2 options.
  • Add "collapsed" class to non-active [collapse] elements (thanks, Artem!)
Download this release

Release Info

Developer FoolsRun
Plugin Icon Bootstrap Shortcodes for WordPress
Version 3.3.4
Comparing to
See all releases

Code changes from version 3.3.2 to 3.3.4

README.md CHANGED
@@ -548,7 +548,7 @@ data | Data attribute and value pairs separated by a comma. Pairs separated by p
548
 
549
  ### Media Objects
550
  [media]
551
- [media-object pull="right"]
552
  ...
553
  [/media-object]
554
  [media-body title="Testing"]
@@ -565,7 +565,8 @@ data | Data attribute and value pairs separated by a comma. Pairs separated by p
565
  #### [media-object] parameters
566
  Parameter | Description | Required | Values | Default
567
  --- | --- | --- | --- | ---
568
- pull | Whether the image pulls to the left or right | optional | left, right | right
 
569
  xclass | Any extra classes you want to add | optional | any text | none
570
  data | Data attribute and value pairs separated by a comma. Pairs separated by pipe (see example at [Button Dropdowns](#button-dropdowns)). | optional | any text | none
571
 
548
 
549
  ### Media Objects
550
  [media]
551
+ [media-object media="left"]
552
  ...
553
  [/media-object]
554
  [media-body title="Testing"]
565
  #### [media-object] parameters
566
  Parameter | Description | Required | Values | Default
567
  --- | --- | --- | --- | ---
568
+ media | Whether the image pulls to the left or right | optional | left, right | right
569
+ pull | Whether the image pulls to the left or right *Deprecated, use only if your theme uses Bootstrap 3.2 or earlier* | optional | left, right | right
570
  xclass | Any extra classes you want to add | optional | any text | none
571
  data | Data attribute and value pairs separated by a comma. Pairs separated by pipe (see example at [Button Dropdowns](#button-dropdowns)). | optional | any text | none
572
 
bootstrap-shortcodes.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Bootstrap 3 Shortcodes
4
  Plugin URI: http://wp-snippets.com/freebies/bootstrap-shortcodes or https://github.com/filipstefansson/bootstrap-shortcodes
5
  Description: The plugin adds a shortcodes for all Bootstrap elements.
6
- Version: 3.3.1
7
  Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
8
  Author URI:
9
  License: GPL2
@@ -36,7 +36,7 @@ class BoostrapShortcodes {
36
 
37
  function __construct() {
38
  add_action( 'init', array( $this, 'add_shortcodes' ) );
39
- add_action( 'wp_enqueue_scripts', array( $this, 'bootstrap_shortcodes_scripts' ), 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
40
  add_action( 'the_post', array( $this, 'bootstrap_shortcodes_tooltip_script' ), 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
41
  add_action( 'the_post', array( $this, 'bootstrap_shortcodes_popover_script' ), 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
42
  }
@@ -1307,6 +1307,9 @@ class BoostrapShortcodes {
1307
 
1308
  $collapse_class = 'panel-collapse';
1309
  $collapse_class .= ( $atts['active'] == 'true' ) ? ' in' : ' collapse';
 
 
 
1310
 
1311
  $parent = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1312
  $current_collapse = $parent . '-'. sanitize_title( $atts['title'] );
@@ -1317,15 +1320,16 @@ class BoostrapShortcodes {
1317
  '<div class="%1$s"%2$s>
1318
  <div class="panel-heading">
1319
  <h4 class="panel-title">
1320
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#%3$s" href="#%4$s">%5$s</a>
1321
  </h4>
1322
  </div>
1323
- <div id="%4$s" class="%6$s">
1324
- <div class="panel-body">%7$s</div>
1325
  </div>
1326
  </div>',
1327
  esc_attr( $panel_class ),
1328
  ( $data_props ) ? ' ' . $data_props : '',
 
1329
  $parent,
1330
  $current_collapse,
1331
  $atts['title'],
@@ -1547,7 +1551,8 @@ function bs_popover( $atts, $content = null ) {
1547
  function bs_media_object( $atts, $content = null ) {
1548
 
1549
  $atts = shortcode_atts( array(
1550
- "pull" => "left",
 
1551
  "xclass" => false,
1552
  "data" => false
1553
  ), $atts );
@@ -1555,12 +1560,16 @@ function bs_popover( $atts, $content = null ) {
1555
  $class = "media-object img-responsive";
1556
  $class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
1557
 
 
 
 
 
1558
  $return = '';
1559
 
1560
  $tag = array('figure', 'div', 'img', 'i', 'span');
1561
  $content = do_shortcode(preg_replace('/(<br>)+$/', '', $content));
1562
  $return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
1563
- $return = '<span class="media-' . esc_attr($atts['pull']) . '">' . $return . '</span>';
1564
  return $return;
1565
  }
1566
 
3
  Plugin Name: Bootstrap 3 Shortcodes
4
  Plugin URI: http://wp-snippets.com/freebies/bootstrap-shortcodes or https://github.com/filipstefansson/bootstrap-shortcodes
5
  Description: The plugin adds a shortcodes for all Bootstrap elements.
6
+ Version: 3.3.4
7
  Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
8
  Author URI:
9
  License: GPL2
36
 
37
  function __construct() {
38
  add_action( 'init', array( $this, 'add_shortcodes' ) );
39
+ //add_action( 'wp_enqueue_scripts', array( $this, 'bootstrap_shortcodes_scripts' ), 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
40
  add_action( 'the_post', array( $this, 'bootstrap_shortcodes_tooltip_script' ), 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
41
  add_action( 'the_post', array( $this, 'bootstrap_shortcodes_popover_script' ), 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
42
  }
1307
 
1308
  $collapse_class = 'panel-collapse';
1309
  $collapse_class .= ( $atts['active'] == 'true' ) ? ' in' : ' collapse';
1310
+
1311
+ $a_class = '';
1312
+ $a_class .= ( $atts['active'] == 'true' ) ? '' : 'collapsed';
1313
 
1314
  $parent = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1315
  $current_collapse = $parent . '-'. sanitize_title( $atts['title'] );
1320
  '<div class="%1$s"%2$s>
1321
  <div class="panel-heading">
1322
  <h4 class="panel-title">
1323
+ <a class="%3$s" data-toggle="collapse" data-parent="#%4$s" href="#%5$s">%6$s</a>
1324
  </h4>
1325
  </div>
1326
+ <div id="%5$s" class="%7$s">
1327
+ <div class="panel-body">%8$s</div>
1328
  </div>
1329
  </div>',
1330
  esc_attr( $panel_class ),
1331
  ( $data_props ) ? ' ' . $data_props : '',
1332
+ $a_class,
1333
  $parent,
1334
  $current_collapse,
1335
  $atts['title'],
1551
  function bs_media_object( $atts, $content = null ) {
1552
 
1553
  $atts = shortcode_atts( array(
1554
+ "pull" => false,
1555
+ "media" => "left",
1556
  "xclass" => false,
1557
  "data" => false
1558
  ), $atts );
1560
  $class = "media-object img-responsive";
1561
  $class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
1562
 
1563
+ $media_class ='';
1564
+ $media_class = ($atts['media']) ? 'media-' . $atts['media'] : '';
1565
+ $media_class = ($atts['pull']) ? 'pull-' . $atts['pull'] : $media_class;
1566
+
1567
  $return = '';
1568
 
1569
  $tag = array('figure', 'div', 'img', 'i', 'span');
1570
  $content = do_shortcode(preg_replace('/(<br>)+$/', '', $content));
1571
  $return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
1572
+ $return = '<span class="' . $media_class . '">' . $return . '</span>';
1573
  return $return;
1574
  }
1575
 
includes/help/README.html CHANGED
@@ -1517,7 +1517,7 @@
1517
  <hr>
1518
  <h3 id="media-objects">Media Objects</h3>
1519
  <pre><code>[media]
1520
- [media-object pull=&quot;right&quot;]
1521
  ...
1522
  [/media-object]
1523
  [media-body title=&quot;Testing&quot;]
@@ -1565,13 +1565,20 @@
1565
  </thead>
1566
  <tbody>
1567
  <tr>
1568
- <td>pull</td>
1569
  <td>Whether the image pulls to the left or right</td>
1570
  <td>optional</td>
1571
  <td>left, right</td>
1572
  <td>right</td>
1573
  </tr>
1574
  <tr>
 
 
 
 
 
 
 
1575
  <td>xclass</td>
1576
  <td>Any extra classes you want to add</td>
1577
  <td>optional</td>
1517
  <hr>
1518
  <h3 id="media-objects">Media Objects</h3>
1519
  <pre><code>[media]
1520
+ [media-object media=&quot;left&quot;]
1521
  ...
1522
  [/media-object]
1523
  [media-body title=&quot;Testing&quot;]
1565
  </thead>
1566
  <tbody>
1567
  <tr>
1568
+ <td>media</td>
1569
  <td>Whether the image pulls to the left or right</td>
1570
  <td>optional</td>
1571
  <td>left, right</td>
1572
  <td>right</td>
1573
  </tr>
1574
  <tr>
1575
+ <td>pull</td>
1576
+ <td>Whether the image pulls to the left or right <em>Deprecated, use only if your theme uses Bootstrap 3.2 or earlier</em></td>
1577
+ <td>optional</td>
1578
+ <td>left, right</td>
1579
+ <td>right</td>
1580
+ </tr>
1581
+ <tr>
1582
  <td>xclass</td>
1583
  <td>Any extra classes you want to add</td>
1584
  <td>optional</td>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: filipstefansson, nodley, FoolsRun
3
  Tags: bootstrap, shortcode, shortcodes, responsive, grid
4
  Requires at least: 3.8
5
  Tested up to: 4.0
6
- Stable tag: 3.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -71,6 +71,10 @@ No, we assume you are already working with a WordPress theme that includes the B
71
 
72
  == Changelog ==
73
 
 
 
 
 
74
  = 3.3 =
75
  * Tested to work with Bootstrap 3.3!
76
  * Only enqueue tooltip and popover trigger javascript if those shortcodes are in use
3
  Tags: bootstrap, shortcode, shortcodes, responsive, grid
4
  Requires at least: 3.8
5
  Tested up to: 4.0
6
+ Stable tag: 3.3.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
71
 
72
  == Changelog ==
73
 
74
+ = 3.3.4 =
75
+ * Restore Bootstrap 3.2 backwards compatibility for [media-object] shortcode, updated documentation to use Bootstrap 3.3 example, but offer 3.2 options.
76
+ * Add "collapsed" class to non-active [collapse] elements (thanks, Artem!)
77
+
78
  = 3.3 =
79
  * Tested to work with Bootstrap 3.3!
80
  * Only enqueue tooltip and popover trigger javascript if those shortcodes are in use