New Landing How can we help? Themeforest Theme Support Neighborhood How to update child theme when I already messed it up

Viewing 3 posts - 16 through 18 (of 18 total)
  • #79220
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hi @lobsterass,

    Sorry for the confusion there, but unfortunately it’s not as simple as that. Copying the files down to a child theme only works basically for template files that are loaded directly by WordPress, not files that contain functions etc. The only way to make changes there is to overwrite the functions in the child theme functions.php file.

    E.g. if you find something in the parent theme, check it has a function_exists wrapper around it:

    if (!function_exists('sf_top_bar')) {
    	function sf_top_bar() {
    	}
    }

    Then you can copy the whole function to your child theme, and make the changes there within the function.

    – Ed

    #79335
    lobsterass
    Member
    Post count: 386

    OK. I don’t understand which file I have to do what in so I’m gonna post an example. How do I do this custom change in the way you describe, so that the child overrides the parent? And did I do the set up in my child folder correctly?


    Change class of portfolio item title to H2 and H3

    You need to edit line 271 in sf-portfolio.php in the swift-framework folder > sf-content-dispaly
    headline
    .= ‘<h4 class=”portfolio-item-title” itemprop=”name headline”>‘. $item_title .’</h4>’. “\n”;
    }
    To:

    .= ‘<h2 class=”portfolio-item-title” itemprop=”name headline”>‘. $item_title .’</h2>’. “\n”;
    }
    And:

    $portfolio_items_output .= ‘<h5 class=”portfolio-subtitle” itemprop=”alternativeHeadline”>’.$item_subtitle.'</h5>’. “\n”;
    }

    to:

    $portfolio_items_output .= ‘<h3 class=”portfolio-subtitle” itemprop=”alternativeHeadline”>’.$item_subtitle.'</h3>’. “\n”;
    }

    #79364
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    I’ve just updated that file to allow the function to be overridden. You will need to replace the whole file contents in the parent theme with: http://pastie.org/pastes

    Then, you can copy across this function to your child theme: http://pastie.org/private/sqg7ncxqbknawbmgisita and make your changes.

    Hope that helps!

    – Ed

Viewing 3 posts - 16 through 18 (of 18 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