Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the astra domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/sqrtyhjzaqx471/public_html/wp-includes/functions.php on line 6121
how to add footer widget in wordpress theme

Home Forums WordPress how to add footer widget in wordpress theme

Viewing 0 reply threads
  • Author
    Posts
    • #150
      softechquery
      Keymaster

      STEP 1: Register a Sidebar-
      If you want to add a sidebar in your WordPress theme then first you need to register it.
      So search the function “function theme-slug_widgets_init()” into function.php file.
      now copy below code into your function for register the sidebar.

      function twentyseventeen_widgets_init() 
      {
      /*................................Copy From Here................................................................*/
      
      register_sidebar( array(
              'name'          => __( 'Footer 2', ‘theme-slug’ ),
              'id'            => 'sidebar-1',
              'description'   => __( 'Add widgets here to appear in your footer.', 'theme-slug' ),
              'before_widget' => '',
              'after_widget'  => '',
              'before_title'  => '',
              'after_title'   => '',
          ) );
      
      /*................................Copy To Here................................................................*/
      
      }

      add_action( ‘widgets_init’, ‘twentyseventeen_widgets_init’ );
      Note:- Here “theme-slug” is your theme name.
      This will add footer widget areas to your theme.
      If you want to add multiple sidebar in footer then just paste the code double time.But change the ‘name’ and ‘id’.

      STEP 2: Now call the sidebar.
      So after register the sidebar you can call it where you want but for footer we call it into “footer.php” file.
      now paste the below code into your “footer.php” file

      /…………………………..Copy From Here………………………………………………………./

      `

      `
      /…………………………..Copy To Here………………………………………………………./

      Note:- Widgets always called by its “Id”.
      If you want to add multiple sidebar in footer then

      /…………………………..Copy From Here………………………………………………………./

      `

      `
      /…………………………..Copy To Here………………………………………………………./

      STEP 3: Now add the CSS
      Just paste bellow CSS in your “style.css” file

      /…………………………..Copy From Here………………………………………………………./

      
      .full-width
      {
        width:100%;
        padding:15px;
        float:left;
      }
      .second-part
      {
        width:50%;
        padding:15px;
        float:left;
      }
      .third-part
      {
        width:33.33%;
        padding:15px;
        float:left;
      }
      .fourth-part
      {
        width:25%;
        padding:15px;
        float:left;
      }

      /…………………………..Copy To Here………………………………………………………./

      That’s it.now you can see your new footer with multiple sidebar.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.
Scroll to Top