0

I'm adding for instance nested columns shortcodes like so:


  // add 5 levels grid nesting
  for ( $i = 1; $i < 6; $i++) {
    $coltag = 'col'.$i;
    add_shortcode( $coltag, 'column_shortcode' );
  }

  // Add COLUMN Shortcode
  public static function column_shortcode( $atts , $content = null ) 
  {

        // Attributes
    extract(shortcode_atts(array(
      'id' => '',
      'width' => '4'
    ), $atts));


    $class = 'col-md-3';

    if ( $content !== '' ) {
      return '<div class="'.$class.'">'. do_shortcode($content) .'</div>';
    }
  }

Question:

How to know what is the tagName inside the column_shortcode function? I would like to be able to return something like <col1 class="col-md-3">CONTENT</col1> for other purposes please?

  • Thanks @fuxia, I used function shortcode_handler( $args = array (), $content = NULL, $shortcode = '' ) and worked for me. – thednp Sep 25 '19 at 20:22

Browse other questions tagged or ask your own question.