• Hi, I have a shortcode.

    // Column
    function snix_shortcode_columns( $atts, $content = null ) {
        extract(shortcode_atts(array(
    	'size'  => 'full', // full width 100% is default
    	'float'	=> '',
    	'text'	=> '',
    	'id'	=> '',
        ), $atts));
    
    	$size = ($size) ? ''.$size : '';
    	$text = ($text) ? ' text'.$text : '';
    	$float = ($float) ? ' float'.$float : '';
    	$id = ($id) ? ''.$id : '';
    
    	if (strpos($size, "last") === false) {
    	// if last is not found
    	return '<div id="'.$id.'" class="' .$size.$float.$text. ' awesome-box"><div class="box-content">' .do_shortcode($content). '</div></div>';
    	}
    	else {
    	// if last is found
    	return '<div id="'.$id.'" class="' .$size.$float.$text. ' awesome-box"><div class="box-content">' .do_shortcode($content). '</div></div>';
    	}
    }
    add_shortcode('box', 'snix_shortcode_columns');
    
    // clean up formatting in shortcodes
    if( !function_exists('snix_shortcode_columns') ) {
    	function snix_shortcode_columns($content){
    		$array = array (
    			'<p>[' => '[',
    			']</p>' => ']',
    			']<br />' => ']'
    		);
    		$content = strtr($content, $array);
    		return $content;
    	}
    	add_filter('the_content', 'snix_shortcode_columns');
    }
    
    //-----------------------------------------------------------//
    
    // article
    function snix_shortcode_article( $atts, $content = null ) {
        extract(shortcode_atts(array(
    	'class'  => '',
        ), $atts));
    
    	$class = ($class) ? $class : '';
    
    	$return = '<article class="' .$class. ' article-box" role="article">
    		<div class="row">
    			<div class="container">'.do_shortcode($content).'</div>
    		</div>
    	</article>';
    	return str_replace('<p></div>','',$return);
    }
    add_shortcode('article', 'snix_shortcode_article');

    When applied it automatically adding br tags and not working p tag properly. am going to use it like

    [article class="WhiteTop"]
    [box size="col-lg-8 col-md-8 col-sm-7 col-xs-12"]content[/box]
    [box size="col-lg-4 col-md-4 col-sm-5 col-xs-12"]image[/box]
    [/article]

    please look at my screenshot and source file

    Thanks All

  • The topic ‘Shortcode issue’ is closed to new replies.