Please make Network more Child-able

Helo there!

I'm playing around with Network (child) theme to show Q&A questions on main site's homepage.

The thing is that I was expecting Network being able to simply replace
network/library/functions/custom-functions.php with my own (modified version):

sc+network/library/functions/custom-functions.php

Then I realize that functions.php is requiring dirname( __FILE__ ).
So I have had to copy functions.php and the whole library/functions/ dir.

Anyway,
near line 85 at functions.php there is a fatal error.

Fatal error: Cannot redeclare network_widgets_init() (previously declared in /var/www/soyciencias.org/wordpress/wp-content/themes/sc+network/functions.php:86) in /var/www/soyciencias.org/wordpress/wp-content/themes/network/functions.php on line 122

Please, add

if ( ! function_exists( 'network_themeoptions_output' ) ) :

...
endif;
properly for the next update. It worked for me.

Regards!

P.S. it would be great to make Network being able to simply replace single php files from library/functions/ maybe by looking first for stylesheetdir and then for themplatepath or something like that

  • Vaughan

    Hi @mauricio,

    I'll make this recommendation to the developer for him to look at. thanks for the feedback, however the widgets does have an action.

    So you can override it in your child theme functions, which is why it doesn't have a function_exists.

    function child_network_widgets_init() {
    	global $themename, $shortname, $options, $options2, $options3, $bp_existed, $multi_site_on;
    register_sidebar(
    	array(
    		'name'          => __( 'Footer', 'network' ),
    		'id'            => 'footer-page',
    		'description'   => 'Footer',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h4 class="widgettitle">',
            'after_title' => '</h4>'
    	)
    );
    register_sidebar(
    	array(
    		'name'          => __( 'Sidebar Blog', 'network' ),
    		'id'            => 'sidebar-blog',
    		'description'   => 'Blog',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h4 class="widgettitle">',
            'after_title' => '</h4>'
    	)
    );
    if($bp_existed == 'true') {
    register_sidebar(
    	array(
    		'name'          => __( 'BuddyPress Pages', 'network' ),
    		'id'            => 'sidebar-members',
    		'description'   => 'BuddyPress pages',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h4 class="widgettitle">',
            'after_title' => '</h4>'
    	)
    );
    }
    }
    add_action( 'widgets_init', 'child_network_widgets_init', 999 );

    Hope this helps

  • Mauricio

    The thing is Network should let user (i.e. wordpress admin) easily override any custom-functions php files (e.g network/library/functions/*.php). But by the actual functons.php construction, for do that you need to copy/replace funcions.php and then the whole library/funtions/ directory.

    By *coping* [0] you don't expect needing to replace anything at the functions.php file, or even needing to hook anything.

    I mean. It should be as easy as copy network/library/functions/any.php -> child/library/functions/any.php. Since that's not the case, it should be as easy as copy functions.php and whole functions/ dir and voilá. That's not the case

    [0] Including content (since making a new blank functions.php will not work because functions.php requiring dirname( __FILE__ ).)

    Thank you @Vaughan