• Hi all,

    I’ve got a child theme question for you. I’m using Woothemes for several sites on a Multisite install and have made pretty light modifications to them, keeping the parent files intact by using WP’s child theme functionality. It’s working well with files such as footer.php, header.php, etc. However, I have a very specific need to remove certain widgets from use, and Woothemes keeps the widget functions in /theme-name/includes/widget-name.php or /theme-name/includes/widgets.php. Mirroring this structure and attempting to edit a child file in the appropriate child theme doesn’t seem to have any effect, and I’m wondering if this is by design and/or there’s a way around it.

    To sum up, I’d like to modify via the child theme capability a set of widgets that live inside several other directories, keeping the parent directories untouched. Any ideas out there?

    As always, thanks for the very helpful WP folks here!

    -Jeff

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Jeff,

    I am looking for an andwer to the same question. Have you figured this out?

    Thanks,
    Karthik

    Try looking at how these widgets are registered via functions.php and overwrite this function in your child theme.

    Thanks for the reply.

    My functions.php has the following

    require_once (/includes/theme-widgets.php'); // Theme widgets

    and the /includes/theme-widgets.php file references

    include( TEMPLATEPATH . '/includes/widgets/widget-woo-social.php' );

    And I am trying to make a change in the widget-woo-social.php file’s content. (A PHP class to be exact)

    Thanks in advance.

    Are either of those 2 lines within a function hooked to an action?

    Actually no. Here is the functions.php in its entirety

    <?php
    // Set path to WooFramework and theme specific functions
    $functions_path = TEMPLATEPATH . '/functions/';
    $includes_path = TEMPLATEPATH . '/includes/';
    
    require_once ($functions_path . 'admin-init.php');			// Framework Init
    
    // Theme specific functionality
    require_once ($includes_path . 'theme-options.php'); 		// Options panel settings and custom settings
    require_once ($includes_path . 'theme-functions.php'); 		// Custom theme functions
    require_once ($includes_path . 'theme-plugins.php');		// Theme specific plugins integrated in a theme
    require_once ($includes_path . 'theme-actions.php');		// Theme actions & user defined hooks
    require_once ($includes_path . 'theme-comments.php'); 		// Custom comments/pingback loop
    require_once ($includes_path . 'theme-js.php');				// Load javascript in wp_head
    require_once ($includes_path . 'sidebar-init.php');			// Initialize widgetized areas
    require_once ($includes_path . 'theme-widgets.php');		// Theme widgets
    ?>

    and the theme-widgets.php here

    <?php
    include( TEMPLATEPATH . '/includes/widgets/widget-woo-social.php' );
    ?>

    and I am trying to make a change in function widget in widget-woo-social.php file

    <?php
    /*---------------------------------------------------------------------------------*/
    /* Address Widget */
    /*---------------------------------------------------------------------------------*/
    class WP_Widget_Social extends WP_Widget {
    
    	function WP_Widget_Social() {
    		$widget_ops = array('classname' => 'widget_social', 'description' => __('Add social links in your sidebar'));
    		$this->WP_Widget('woo_social', __('Woo - Social'), $widget_ops);
    	}
    
    	function widget( $args, $instance ) {
    		extract($args);
    		$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
    
    		$facebook = apply_filters( 'widget_facebook', $instance['facebook'], $instance );
    		$twitter = apply_filters( 'widget_twitter', $instance['twitter'], $instance );
    		$flickr = apply_filters( 'widget_flickr', $instance['flickr'], $instance );
    		$youtube = apply_filters( 'widget_facebook', $instance['youtube'], $instance );
    
    		echo $before_widget;
    		if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
    
    			<div class="socialwidget">
    			<?php if ( !empty( $facebook ) ) { echo '<a href="'.$facebook.'" class="ico-facebook">'.__('Facebook','woothemes') . '</a>'; } ?>
    			<?php if ( !empty( $twitter ) ) { echo '<a href="'.$twitter.'" class="ico-twitter">'.__('Twitter','woothemes') . '</a>'; } ?>
    			<?php if ( !empty( $flickr ) ) { echo '<a href="'.$flickr.'" class="ico-flickr">'.__('LinkedIn','woothemes') . '</a>'; } ?>
    			<?php if ( !empty( $youtube ) ) { echo '<a href="'.$youtube.'" class="ico-youtube">'.__('Youtube','woothemes') . '</a>'; } ?>
    			<div class="clear"></div>
    			</div>
    
    		<?php
    		echo $after_widget;
    	}
    ......
    ......
    ......
    ?>

    Oh dear. It’s really not very child theme friendly at all. I really don’t know what to suggest other than porting the functions.php over.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Child theme use via subdirectories?’ is closed to new replies.