• Resolved Greg

    (@gsdmedia)


    Maybe you guys can help me out with this. I created a simple version of a plugin I’m working on to add widget-sidebars dynamically via shortcode. I created a very simple version of what I’m talking about so I could post code for you to look at:

    add_shortcode('Test', 'cs_test_shortcode');
    function cs_test_shortcode(){
    
    	return dynamic_sidebar('cs-test-sidebar');
    }
    add_action( 'widgets_init', 'cs_test_init_widgets' );
    function cs_test_init_widgets(){
    	$args = array(
    	'name'          => 'cs-test-sidebar',
    	'id'            => 'cs-test-sidebar',
    	'description'   => '',
            'class'         => '',
    	'before_widget' => '
    <li>',
    	'after_widget'  => '</li>
    ',
    	'before_title'  => '<h2 class="widgettitle">',
    	'after_title'   => '</h2>' );
    
    	register_sidebar($args);
    }

    Which works beautifully, I put the shortcode in a post and the widgets I have defined in the section show, but for some reason every section has the number “1” appended. It isn’t enclosed in tags or anything.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sidebars Appending the Number "1" after widgets’ is closed to new replies.