Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author MWDelaney

    (@foolsrun)

    WordPress can’t nest shortcodes of the same name (noted as a limitation in the Codex here). Unfortunately, because this is a limitation of WordPress and not of this plugin there isn’t much we can do to fix it.

    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 ??

    Plugin Author MWDelaney

    (@foolsrun)

    We believe this would make this plugin overly complicated. We have to balance end-user ease with functionality and since WordPress itself doesn’t support nested shortcodes of the same name we’ve decided not to support them in this plugin.

    Sorry!

    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)

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

    Plugin Author MWDelaney

    (@foolsrun)

    Thank you! We appreciate your support and the review!

    I’ve just encountered this while using your plugin (great plugin by the way). While I understand your reasons for not wanting to complicate things, in my case it renders the plugin almost useless. Is it not possible to add the ability to create [row-x][/row-x] for those of us who want to get tricky?

    Plugin Author MWDelaney

    (@foolsrun)

    Thanks for your kind words!

    We haven’t discussed nested grids in a while. I will bring it up with the other developers. I think it adds too much complication to the plugin and makes it difficult to document, but maybe we can work something out.

    I can’t promise we will add this feature, and it can’t say when, if ever, it’ll make it’s way to the www.remarpro.com repository, but we’ll revisit the issue.

    Thanks again!

    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 ??

    Plugin Author MWDelaney

    (@foolsrun)

    Thanks for posting this!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Inner row ?’ is closed to new replies.