Categories

WordPress. How to add widget area

Norman Fisher March 3, 2014
Rating: 3.8/5. From 4 votes.
Please wait...

This tutorial is going to show how to add a new widget area to your WordPress Cherry Framework template.

WordPress. How to add widget area

  1. On your FTP, go to the wp-content/themes/CherryFramework folder.

  2. Open functions.php.

  3. Hit Ctrl (Command) + F, search for the following lines:

    //Sidebar
    include_once (CHILD_DIR . '/includes/sidebar-init.php');
    

    This line defines the $includes_path variable value:

    $includes_path = TEMPLATEPATH . '/includes/'; 

    And shows that the widgets are defined in the wp-content/themes/theme#####/includes/sidebar-init.php file

  4. Go to the wp-content/themes/theme#####/includes folder and open sidebar-init.php to edit.

  5. Copy the following block of code:

    // Footer Widget Area
    // Location: at the top of the footer
    register_sidebar(array(
       'name' => __("Footer Area", CURRENT_THEME),
       'id' => 'footer-sidebar',
       'description' => theme_locals("footer_desc"),
       'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', )); }

    and paste it before the closing ‘}’ bracket of the elegance_widgets_init() function.

  6. Change the ‘name’, ‘id’ and ‘description’ values. Change the comments:

    // New Widget Area
    // Location: at the top of the gallery page
    register_sidebar(array(
       'name' => __("New Widget Area", CURRENT_THEME),
       'id' => 'new-widget-area-sidebar',
       'description' => __("New Widget Area", CURRENT_THEME),
       'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', )); }
  7. Save the changes to the file. Now, if you go to the Appearance>Widgets menu in your admin, the new widget area should be there. Go ahead and add a widget to that area.

    wordpress_cherry_new_widget_area_adding_1

  8. Now you can insert the widget area to any part of the template. Go back to the ‘wp-content/themes/ CherryFramework‘ folder. You can insert the newly created widget area to any of the layout files.

  9. For instance, if you need to add the widget area to the “Gallery2” page (that uses “Filter Folio 2 cols” page template), copy page-Portfolio2Cols-filterable.php from the wp-content/themes/CherryFramework folder.

  10. Paste it to the wp-content/themes/theme#####‘ folder and open it to edit.

  11. Paste the following code to the required place to insert the widget area (where ‘New Widget Area’  is your widget area name) and save the changes:

       
    
  12. If everything was done correctly, the new widget area will be available on the pages that use a page template you added it to.

    wordpress_cherry_new_widget_area_adding_2

Feel free to check the detailed video tutorial below:

WordPress. How to add widget area

Excellent Wordpress Themes
This entry was posted in WordPress, WordPress Tutorials and tagged add, area, Cherry, widget, WordPress. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket