New Landing How can we help? Themeforest Theme Support Neighborhood How to use child theme but still edit theme files and not lose changes in Update

Viewing 12 posts - 1 through 12 (of 12 total)
  • #162481
    veruschia
    Member
    Post count: 29

    Hi

    I previously did alot of changes in Neighborhood theme files (without child theme) only to realise with update that all my changes were overwritten.

    How do I use the child theme (I already uploaded and activated it) and still edit theme files. In the folder I only see a style CSS, no other files.

    Do I still change content in the main theme files and only update the child theme. Sorry for the confusion, i am not sure what to do.

    #162488
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please take files from parent theme and paste at child theme directory. Now edit these files as child theme directory.
    Thanks
    Mohammad

    #162492
    veruschia
    Member
    Post count: 29

    with the same folder structure, or can i just paste directly

    #162495
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    With the same folder structure.
    Thanks
    Mohammad

    #168980
    veruschia
    Member
    Post count: 29

    I am having issues with the child theme not picking up my php changes. I have uploaded and activated the child theme: neighborhood-child.

    Example: I wanted to change the sf_header.php file. So I find the php file here:
    /neighborhood/includes/swift-framework/sf-content-display/sf-header.php

    I change “Welcome” to “Hello” in line 469

    Then I upload the new sf-header.php to the child theme here:
    /neighborhood-child/includes/swift-framework/sf-content-display/sf-header.php

    The change does not work. What am I doing wrong?

    #168985
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    That file would require to add a lot more files.
    Do it like this.

    copy your entire changed function to the functions.php of the child theme. It will work fine.

    
    if (!function_exists('sf_woo_links')) {
    		function sf_woo_links($position, $config = "") {
    
    			// VARIABLES
    			$options = get_option('sf_neighborhood_options');
    			$tb_search_text = $options['tb_search_text'];
    			$woo_links_output = $ss_enable = "";
    
    			if (isset($options['ss_enable'])) {
    				$ss_enable = $options['ss_enable'];
    			} else {
    				$ss_enable = true;
    			}
    
    			// WOO LINKS OUTPUT
    			$woo_links_output .= '<nav class="std-menu '.$position.'">'. "\n";
    			$woo_links_output .= '<ul class="menu">'. "\n";
    			if ( sf_woocommerce_activated() ) {
    				if (is_user_logged_in()) {
    					global $current_user;
    					get_currentuserinfo();
    					$woo_links_output .= '<li class="tb-welcome">' . __("Hello", "swiftframework") . " " . $current_user->display_name . '</li>'. "\n";
    				} else {
    					$woo_links_output .= '<li class="tb-welcome">' . __("Hello", "swiftframework") . '</li>'. "\n";
    				}
    			}
    			if ($ss_enable) {
    				if ($position == "top-menu") {
    				$woo_links_output .= '<li class="tb-woo-custom clearfix"><a class="swift-search-link" href="#"><i class="fa-search-plus"></i><span>'.do_shortcode($tb_search_text).'</span></a></li>'. "\n";
    				} else {
    				$woo_links_output .= '<li class="hs-woo-custom clearfix"><a class="swift-search-link" href="#"><i class="fa-search-plus"></i><span>'.do_shortcode($tb_search_text).'</span></a></li>'. "\n";
    				}
    			}
    			$woo_links_output .= '</ul>'. "\n";
    			$woo_links_output .= '</nav>'. "\n";
    
    			// RETURN
    			return $woo_links_output;
    		}
    	}

    -Rui

    #168991
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please dont make this small change like this. Please install and use this plugin https://wordpress.org/plugins/real-time-find-and-replace/ at Admin -> Tools . You can change this text easily through this plugin.
    Thanks
    Mohammad

    #169060
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Nothing wrong in my change suggestion, it’s just a better way to achieve the same you already did.

    Mohammad alternative will replace all the words “Welcome” in the site by the word “Hello” and sometimes that’s not the desired.

    -Rui

    #169071
    veruschia
    Member
    Post count: 29

    Thanks Rui,

    yes i need to redo functions: the hello was just one example, but i need to realign the header with subscription being last and my account first etc.

    #169073
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    no problem.
    -Rui

    #169077
    veruschia
    Member
    Post count: 29

    Brilliant works like a charm. Cannot thank you enough!

    #169081
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Great. Glad it’s sorted.
    -Rui

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register