thegreenwebfoundation / tgwf2015

The wordpress theme in use on www.thegreenwebfoundation.org
GNU General Public License v3.0
0 stars 1 forks source link

Current theme scripts stop wp-forms from working #8

Open mrchrisadams opened 3 years ago

mrchrisadams commented 3 years ago

We currently have this snippet in our theme, which clashes with some new plugins, and means we can't use wp-form to more efficiently handle inbound requests.

/* Custom scripts */
function customScriptStyles() {
    /* Clean up unused styles & scripts */
    wp_deregister_script( 'jquery' );

    /* Enqueue styles */        
    wp_enqueue_style( 'tgwf-bootstrap', get_stylesheet_directory_uri() . '/css/bootstrap.min.css' , array(), '1.0', 'all' );
    wp_enqueue_style( 'tgwf-style',get_stylesheet_uri('tgwf-bootstrap'), array(), '1.0' , 'all' );
    wp_enqueue_style( 'tgwf-font-awesome','//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array(), '1.0' , 'all' );
    wp_enqueue_style( 'tgwf-google-font-lato','//fonts.googleapis.com/css?family=Lato:100,300,400,700', array(), '1.0' , 'all' );
    wp_enqueue_style( 'tgwf-google-font-raleway','//fonts.googleapis.com/css?family=Raleway:400,600', array(), '1.0' , 'all' );
    wp_enqueue_style( 'tgwf-navigations', get_stylesheet_directory_uri() . '/css/responsive-nav.css' , array(), '1.0', 'all' );     

    /* Enqueue scripts */
    wp_enqueue_script( 'tgwf-jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js' , array(), '', false );
    wp_enqueue_script( 'tgwf-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js' , array('tgwf-jquery'), '', true );           
    wp_enqueue_script( 'tgwf-nav', get_stylesheet_directory_uri() . '/js/responsive-nav.min.js' , array(), '1.0', false );
    wp_enqueue_script( 'tgwf-slimscroll', get_stylesheet_directory_uri() . '/js/jquery.slimscroll.min.js' , array('tgwf-jquery-ui'), '1.0', true );
    wp_enqueue_script( 'tgwf-smoothscroll', get_stylesheet_directory_uri() . '/js/jquery.easing.min.js' , array('tgwf-jquery'), '1.0', true );  

    if ( is_front_page() ) {
        /* Enqueue styles */    
        wp_enqueue_style( 'tgwf-fullpage', get_stylesheet_directory_uri() . '/css/jquery.fullPage.css' , array(), '1.0', 'all' );       
        wp_enqueue_style( 'tgwf-animate', get_stylesheet_directory_uri() . '/css/animate.css' , array(), '1.0', 'all' );

        /* Enqueue scripts */           
        wp_enqueue_script( 'tgwf-chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js' , array('tgwf-jquery'), '1.0', true );
        wp_enqueue_script( 'tgwf-fullpage', get_stylesheet_directory_uri() . '/js/jquery.fullPage.min.js' , array('tgwf-jquery'), '1.0', true );
        wp_enqueue_script( 'tgwf-wow', get_stylesheet_directory_uri() . '/js/wow.min.js' , array('tgwf-jquery'), '1.0', false );
        wp_enqueue_script( 'tgwf-covervid', get_stylesheet_directory_uri() . '/js/covervid.js' , array('tgwf-jquery'), '1.0', true );
        wp_enqueue_script( 'tgwf-fire-covervid', get_stylesheet_directory_uri() . '/js/fire-covervid.js' , array('tgwf-covervid'), '1.0', true );
        wp_enqueue_script( 'tgwf-moment', get_stylesheet_directory_uri() . '/js/moment.js' , array('tgwf-jquery'), '', false );  
        wp_enqueue_script( 'tgwf-scripts',get_stylesheet_directory_uri() . '/js/tgwf.js' , array('tgwf-jquery','tgwf-moment'), '', false );
        wp_enqueue_script( 'tgwf-numeral', get_stylesheet_directory_uri() . '/js/numeral.js', array(), '1.0', true );           
        wp_enqueue_script( 'tgwf-app-link', get_stylesheet_directory_uri() . '/js/browserdetect.js' , array(), '1.0', true );   
    }

    if ( is_page('directory') ) {
        /* Enqueue styles */    
        wp_enqueue_style( 'tgwf-jqvmap', get_stylesheet_directory_uri() . '/css/jqvmap.css' , array(), '1.0', 'all' );      

        /* Enqueue scripts */   
        wp_enqueue_script( 'tgwf-scripts', get_stylesheet_directory_uri() . '/js/tgwf.js' , array('tgwf-jquery'), '', false );      
        wp_enqueue_script( 'tgwf-vmap', get_stylesheet_directory_uri() . '/js/jquery.vmap.js' , array('tgwf-jquery'), '1.0', true );
        wp_enqueue_script( 'tgwf-vmap-world', get_stylesheet_directory_uri() . '/maps/jquery.vmap.world.js' , array('tgwf-jquery'), '1.0', true );
        wp_enqueue_script( 'tgwf-directory', get_stylesheet_directory_uri() . '/js/directory.js', array(), '1.0', true );                       

    }

    if ( is_page('green-web-check') ) {
        wp_enqueue_script( 'tgwf-app-link', get_stylesheet_directory_uri() . '/js/browserdetect.js' , array(), '1.0', true );  
    }
}
add_action('wp_enqueue_scripts', 'customScriptStyles');

We need to resolve this in order for wp-form to work.

mrchrisadams commented 3 years ago

What I think is happening here is that either:

Given that we're working on a new theme anyway, it might be simpler to focus on getting WPForms to work on the new one, rather than dig into this here, as I suspect it'll be messy work , untangling years old javascript dependencies.