Making jQuery Google API after theme update

Hi, see https://www.logoglo.com/

I have installed the latest theme update, I have a child theme with this code:


<?php
//Making jQuery Google API
function modify_jquery() {
    if (!is_admin()) {
        // comment out the next two lines to load the local copy of jQuery
        wp_deregister_script('jquery');
        wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', false, '1.12.4');
        wp_enqueue_script('jquery');
    }
}

This is to make the theme load googles jquery library, it was working before, but with the update, its stopped working, and its loading the local jquery file…can you help?

Thanks.

Hello @logoglo,

Thanks for writing in!

Please update your functions.php file and use this:

<?php
// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Overwrite or add your own custom functions to X in this file.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Enqueue Parent Stylesheet
//   02. Additional Functions
// =============================================================================

// Enqueue Parent Stylesheet
// =============================================================================

add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );



// Additional Functions
// =============================================================================

//Making jQuery Google API
function modify_jquery() {
    if (!is_admin()) {
        // comment out the next two lines to load the local copy of jQuery
        wp_deregister_script('jquery');
        wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', false, '1.12.4');
        wp_enqueue_script('jquery');
    }
}
add_action('after_setup_theme', 'modify_jquery');
//
add_action( 'wp_footer', 'my_custom_js', 10 );

function my_custom_js(){
    echo '
<script type="text/javascript">
var infolinks_pid = 3018483;
var infolinks_wsid = 0;
</script>
<script src="//code.tidio.co/g83dcaaspzbflh32uqpnk5uzbqxs3psw.js"></script>
    ';
}




// Excerpt More String
// =============================================================================

if ( ! function_exists( 'x_excerpt_string' ) ) :
  function x_excerpt_string( $more ) {

    $stack = x_get_stack();

    if ( $stack == 'integrity' ) {
      return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>';
    } else if ( $stack == 'renew' ) {
      return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>';
    } else if ( $stack == 'icon' ) {
      return ' ...';
    } else if ( $stack == 'ethos' ) {
      return ' ...<a href="' . get_permalink() . '" class="more-link">' . __( 'Read More &raquo;', '__x__' ) . '</a>';
    }

  }
  add_filter( 'excerpt_more', 'x_excerpt_string' );
endif;


/* Fix "Missing Author" and "Missing Updated" issue - START */
// =============================================================================
add_filter( 'the_content', 'custom_author_code');
function custom_author_code($content) {
   if (is_singular() || is_single()) {
      return $content . 
      '<div class="hatom-extra"><span class="title">'. get_the_title() .'</span> was last modified: <span class="updated"> '. get_the_modified_time('F jS, Y') .'</span> by <span class="author vcard"><span class="fn">'. get_the_author() .'</span></span></div>' ;
   } else {
      return $content;
   }
}
/* Fix "Missing Author" and "Missing Updated" issue - END */


// =============================================================================
function exclude_jetpack_related_from_portfolio( $options ) {
    if ( 'jetpack_portfolio' == get_post_type() ) {
        $options['enabled'] = false;
    }
    return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'exclude_jetpack_related_from_portfolio' );


// =============================================================================
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );


// =============================================================================
function x_ethos_featured_index() { ?>

    <a href="#" class="entry-thumb<?php echo $index_featured_layout_class; echo $index_featured_size_class; ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>"> </a>

<?php }

By the way, your child theme is not active that is why all of your customizations were not applied in your site.

Please let us know how it goes.

That was actually the reason, it wasnt activated, doh! I feel silly. Thanks.

You’re welcome!
We’re glad we were able to help you out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.