skip to Main Content

I have purchased the Disputo theme that doesn’t display any sidebars.
I want to keep my theme but display the sidebar on the home page.

Is there a way to do this?

2

Answers


  1. you can edit sidebar from appearance > widget. in order display sidebar you have to choose sidebar template from page edit. there will be changes according to different themes , but this works for most of the themes out there.

    Login or Signup to reply.
  2. If you have no sidebar option then you can put this code on function.php file

    /**
     * function.php
     */
    function wpdocs_theme_slug_widgets_init() {
        register_sidebar( array(
            'name'          => __( 'Main Sidebar', 'textdomain' ),
            'id'            => 'sidebar-1',
            'description'   => __( 'Widgets in this area will be shown on all posts and pages.', 'textdomain' ),
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget'  => '</li>',
            'before_title'  => '<h2 class="widgettitle">',
            'after_title'   => '</h2>',
        ) );
    }
    add_action( 'widgets_init', 'wpdocs_theme_slug_widgets_init' );
    

    Then put this code index.php for showing output

    <?php if ( is_active_sidebar( 'sidebar-1' ) ) { ?>
        <ul id="sidebar">
            <?php dynamic_sidebar('sidebar-1'); ?>
        </ul>
    <?php } ?>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search