• Resolved niallolaoghaire

    (@niallolaoghaire)


    Hi
    I can get the new widget to work in the parent theme’s (I’m using Responsive) functions.php
    but when I make a new functions.php file in the child theme with

    <?php
        function responsive_widgets_init() {
    	register_sidebar(array(
                'name' => __('Home Top Image', 'responsive'),
                'description' => __('Area 12 - home-top-image.php', 'responsive'),
                'id' => 'home-top-image',
                'before_title' => '<div class="widget-title">',
                'after_title' => '</div>',
                'before_widget' => '<div id="%1$s" class="%2$s">',
                'after_widget' => '</div>'
            ));
        }
        add_action('widgets_init', 'responsive_widgets_init');
    ?>

    I get an error message in my browser: Fatal error: Cannot redeclare responsive_widgets_init() (previously declared in /home/c1944495/public_html/xxxlarrysxxx/wp-content/themes/child_of_responsive/functions.php:9) in /home/c1944495/public_html/xxxlarrysxxx/wp-content/themes/responsive/includes/functions.php on line 18

Viewing 2 replies - 1 through 2 (of 2 total)
  • simply use a differnt function name;

    instead:
    'responsive_widgets_init'
    use for example:
    'responsivechild_widgets_init'

    and the same here:
    function responsivechild_widgets_init() {

    Thread Starter niallolaoghaire

    (@niallolaoghaire)

    Ah, thank you kind sir, that worked!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding a new widget to a Child Theme's functions.php’ is closed to new replies.