Skip to content

Instantly share code, notes, and snippets.

@AndreaBarghigiani
Created February 18, 2020 14:00
Show Gist options
  • Save AndreaBarghigiani/5e4075fedc5bd2454d13305ab26d161a to your computer and use it in GitHub Desktop.
Save AndreaBarghigiani/5e4075fedc5bd2454d13305ab26d161a to your computer and use it in GitHub Desktop.
WordPress aggiungere script e calcolare totale da cella di una tabella.
<?php
add_action('wp_enqueue_scripts', 'sam_load_scripts');
function sam_load_scripts(){
wp_enqueue_script( 'slug-tuo-script', get_bloginfo( 'stylesheet_directory' ) . '/js/tuo-script.js', array( 'jquery' ), '1.0.0' );
}
jQuery(document).ready(function($) {
let tot = 0;
$('.tua-classe td:nth-child(posizione)').each(function(){
tot += $(this).html();
});
//Trova un elemento HTML e aggiungi il tuo totale
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment