Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter keving1

    (@keving1)

    Hello,

    This is the solution that worked for me. As I say, it’s not really clean but it can do the trick.

    add this to the bootstrap-shortcodes.php

    function row_inner($atts, $content = null)
    {
        return '<div class="row">' . do_shortcode($content) . '</div>';
    }
    add_shortcode('row_inner', 'row_inner');
    
    function bs_columninner( $atts, $content = null ) {
    
        extract( shortcode_atts( array(
          "lg"          => false,
          "md"          => false,
          "sm"          => false,
          "xs"          => false,
          "offset_lg"   => false,
          "offset_md"   => false,
          "offset_sm"   => false,
          "offset_xs"   => false,
          "pull_lg"     => false,
          "pull_md"     => false,
          "pull_sm"     => false,
          "pull_xs"     => false,
          "push_lg"     => false,
          "push_md"     => false,
          "push_sm"     => false,
          "push_xs"     => false,
          "xclass"      => false,
          "data"        => false
        ), $atts ) );
    
        $class  = '';
        $class .= ( $lg )             ? ' col-lg-' . $lg : '';
        $class .= ( $md )             ? ' col-md-' . $md : '';
        $class .= ( $sm )             ? ' col-sm-' . $sm : '';
        $class .= ( $xs )             ? ' col-xs-' . $xs : '';
        $class .= ( $offset_lg )      ? ' col-lg-offset-' . $offset_lg : '';
        $class .= ( $offset_md )      ? ' col-md-offset-' . $offset_md : '';
        $class .= ( $offset_sm )      ? ' col-sm-offset-' . $offset_sm : '';
        $class .= ( $offset_xs )      ? ' col-xs-offset-' . $offset_xs : '';
        $class .= ( $pull_lg )        ? ' col-lg-pull-' . $pull_lg : '';
        $class .= ( $pull_md )        ? ' col-md-pull-' . $pull_md : '';
        $class .= ( $pull_sm )        ? ' col-sm-pull-' . $pull_sm : '';
        $class .= ( $pull_xs )        ? ' col-xs-pull-' . $pull_xs : '';
        $class .= ( $push_lg )        ? ' col-lg-push-' . $push_lg : '';
        $class .= ( $push_md )        ? ' col-md-push-' . $push_md : '';
        $class .= ( $push_sm )        ? ' col-sm-push-' . $push_sm : '';
        $class .= ( $push_xs )        ? ' col-xs-push-' . $push_xs : '';
        $class .= ( $xclass )   ? ' ' . $xclass : '';
    
        $data_props = $this->parse_data_attributes( $data );
    
        return sprintf(
          '<div class="%s"%s>%s</div>',
          esc_attr( $class ),
          ( $data_props ) ? ' ' . $data_props : '',
          do_shortcode( $content )
        );
      }

    Don’t forget to add ‘columninner’ to the add_shortcode function at line 65.

    function add_shortcodes() {
    
        $shortcodes = array(
          'alert',
          'badge',
          'breadcrumb',
          'breadcrumb-item',
          'button',
          'button-group',
          'button-toolbar',
          'caret',
          'carousel',
          'carousel-item',
          'code',
          'collapse',
          'collapsibles',
          'column',
          'columninner',
    
    ...

    Then you just have to call [row_inner] and [columninner] everytime you want inner rows and cols ??

    Thread Starter keving1

    (@keving1)

    And btw the plugin is excellent that’s why I didn’t want to use another one :-p

    Thread Starter keving1

    (@keving1)

    I totally understand what you mean. I found the solution by adding some code to yours. It’s not clean but it works for me. I’m not sure it will be for the en-user as you said.

    Thanks anyway ??

    Thread Starter keving1

    (@keving1)

    Hello,

    Thank you for your answer.

    Do you think it is possible to use other name for inner rows as [row_x] for exemple to avoid this ?

    They talk about this : https://www.pagelines.com/shop/plugins/grid-shortcodes/

    Nested Grid

    But I don’t really know how to put that in a function ??

Viewing 4 replies - 1 through 4 (of 4 total)