Home Forums Square Adding a new sidebar

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #298
    sknapp
    Participant

    I want to add a second left sidebar to my site libertysquarewifi.com as a secondary navigation for my About page.

    I did this by creating a new widgetized area in sidebar.php., creating the new layout option in inc/square-metabox.php, and adding this to the functions in my child theme:

    register_sidebar( array(
    	'name'          => esc_html__( 'Left Sidebar 2', 'square' ),
        	'id'            => 'square-left-sidebar-2',
        	'description'   => '',
        	'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        	'after_widget'  => '</aside>',
        	'before_title'  => '<h4 class="widget-title">',
        	'after_title'   => '</h4>',
    ) );
    add_action( 'widgets_init', 'square_widgets_init' );

    This made the sidebar appear in the customizer and let’s me add widgets to it but it won’t appear in the page editor to let me apply the new sidebar layout to the page I need it on.

    Is there another file I need to edit or put in my child them to make it appear or have I just done something wrong?

    #303
    Hash
    Keymaster

    Hi,

    Please use this plugin https://wordpress.org/plugins/restrict-widgets/
    This should easily let you restrict the widget to show/hide in the desired pages without having to create multiple widgets.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.