Child Theme - Overriding Custom.js File

Discussion in 'ButterBelly WordPress Theme' started by tiffany_mclain, Nov 7, 2014.

  1. tiffany_mclain

    tiffany_mclain New Member

    Joined:
    Oct 2, 2014
    Messages:
    4
    Likes Received:
    0
    Hello,

    I'm new to WordPress, and am learning how to make a child-theme. I have actually gotten the required files for implementing a child-theme set up and began customizations in the order that issues arose.

    My current issue is, after de-registering inkthemes-cunfon-yui and inkthemes-Museo-font, I threw an error in my console log. The error is due to the line Cufon.replace('h1')('h2')('h3')('h4')('h5')('h6')('.ddsmoothmenu a') within js/custom.js. I tried deregistering inkthemes-custom and then enqueuing a modified copy of custom.js located in the child theme, but something has the request searching for the file with "?v437" or something of that nature, appended to the end of custom.js. I understand this is some caching going on, but am not familiar as to where this is happening.

    I'd like to move ahead with pulling custom.js from the child-theme, but am looking for assistance in determining what(if anything else) needs to be copied to the child-theme to get past this error. FYI - The tabbed interface on the home page does not render properly after this error is incurred. My current solution is commenting out the Cufon.replace line in the custom.js file of ButterBelly parent theme. That action totally goes against the reasoning for the child-theme though.

    Any help with this would be greatly appreciated. I thought to try here first, hoping that someone would know a solution from experience. I'll check other online resources to see if I can figure out how to work with the caching, as to pull in the modified custom.js from my child-theme.

    Thank you!
     
  2. tiffany_mclain

    tiffany_mclain New Member

    Joined:
    Oct 2, 2014
    Messages:
    4
    Likes Received:
    0
    My fault.

    I'd overlooked an argument used in the original wp_enqueue_script() function of the parent theme.
    wp_deregister_script( 'inkthemes-custom' );
    wp_enqueue_script('inkthemes-custom', get_stylesheet_directory_uri() . '/js/custom.js', array('jquery'));

    All is good!
     

Share This Page