Functions.php overwrite problem

Discussion in 'Andrina WordPress Theme' started by bobvonelgg, Jan 27, 2014.

?

has anyone customized the functions php files?

  1. How to add to functions php

    0 vote(s)
    0.0%
  2. How to add a third sidebar

    0 vote(s)
    0.0%
  1. bobvonelgg

    bobvonelgg New Member

    Joined:
    Aug 5, 2013
    Messages:
    2
    Likes Received:
    0
    Hi, I have created a child theme of Andrina and I want to add one small item to functions.php - I want to create one more sidebar widget called "Capabilities Widget" that will show up in Appearances > Widgets back end area. Then, when my client creates a page using the "Capabilities" template, that particular sidebar content shows up.

    So, in the Andrina theme, the widgets are not called out in functions.php, they're called out in inkthemes-functions.php. When I tried to create an inkthemes-functions.php in my child theme, it does nothing. When I try to create a functions.php that calls the new list of sidebars, it overwrites the entire functions.php file of the Andrina theme and everything is broken.

    Can you please help?

    Here is the php I am trying to add to functions;
    <?php

    function inkthemes_widgets_init() {

    // Area 1, located at the top of the sidebar.

    register_sidebar(array(

    'name' => __('Primary Widget Area', 'andrina'),

    'id' => 'primary-widget-area',

    'description' => __('The primary widget area', 'andrina'),

    'before_widget' => '',

    'after_widget' => '',

    'before_title' => '<h4>',

    'after_title' => '</h4>',

    ));

    // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.

    register_sidebar(array(

    'name' => __('Secondary Widget Area', 'andrina'),

    'id' => 'secondary-widget-area',

    'description' => __('The secondary widget area', 'andrina'),

    'before_widget' => '',

    'after_widget' => '',

    'before_title' => '<h4>',

    'after_title' => '</h4>',

    ));

    // Area 3, located in the footer. Empty by default.

    register_sidebar(array(

    'name' => __('First Footer Widget Area', 'andrina'),

    'id' => 'first-footer-widget-area',

    'description' => __('The first footer widget area', 'andrina'),

    'before_widget' => '',

    'after_widget' => '',

    'before_title' => '<h4>',

    'after_title' => '</h4>',

    ));

    // Area 4, located in the footer. Empty by default.

    register_sidebar(array(

    'name' => __('Second Footer Widget Area', 'andrina'),

    'id' => 'second-footer-widget-area',

    'description' => __('The second footer widget area', 'andrina'),

    'before_widget' => '',

    'after_widget' => '',

    'before_title' => '<h4>',

    'after_title' => '</h4>',

    ));

    // Area 5, located in the footer. Empty by default.

    register_sidebar(array(

    'name' => __('Third Footer Widget Area', 'andrina'),

    'id' => 'third-footer-widget-area',

    'description' => __('The third footer widget area', 'andrina'),

    'before_widget' => '',

    'after_widget' => '',

    'before_title' => '<h4>',

    'after_title' => '</h4>',

    ));

    // Area 6 sidebar, located on the capabilities page.

    register_sidebar(array(

    'name' => __('Capabilities Widget Area', 'andrina'),

    'id' => 'capabilities-widget-area',

    'description' => __('Capabilities area', 'andrina'),

    'before_widget' => '',

    'after_widget' => '',

    'before_title' => '<h4>',

    'after_title' => '</h4>',

    ));

    }

    ?>
     
  2. Piyush

    Piyush Support Staff

    Joined:
    Dec 8, 2012
    Messages:
    4,745
    Likes Received:
    107
    Hello,

    Child theme only works for files in the parent directory , it will not work with the sub directory.

    If you want to show different widget in different pages then you can try Dynamic Widgets plugin for this issue.
    Download it from the link given below and install it from the Plugins panel (Plugins ->Add New ->Upload) in your Dashboard.
    http://wordpress.org/plugins/dynamic-widgets/

    See the link for reference
    http://www.inkthemes.com/easily-control-appearance-of-widgets-on-your-wordpress-pages/02/

    I hope it will help you.
     

Share This Page