Disculpas si esta es una pregunta estúpida, pero ¿cómo hago para que WordPress realmente mire mi código? Lo está ignorando por completo y simplemente obedeciendo el HTML.
Es como si el jQuery no estuviera allí en absoluto. Estoy seguro de que cometí algunos errores en el código jQuery, pero no tengo una idea real, ya que ni siquiera puedo probarlo.
He leído que el ‘$’ debe cambiarse a jQuery
que he hecho Instalé _js en el archivo public_html y también agregué el texto jQuery allí en caso de que eso ayudara.
También agregué lo siguiente a functions.php
en el consejo de otros aquí:
function add_my_script() {
wp_enqueue_script('custom-script', get_template_directory_uri() .'/_js/meet-the-team.js', array('jquery'));
}
add_action( 'wp_enqueue_scripts', 'add_my_script' );
Este es el código que se está ignorando:
<script src="https://stackoverflow.com/questions/59200359/_js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#gallery img').each(function(i) {
var imgFile = jQuery(this).attr('src');
var preloadImage = new Image(); =
var imgExt = /(.w{3,4}$)/;
preloadImage.src = imgFile.replace(imgExt, '_h$1');
jQuery.noConflict();
jQuery(this).hover(
function() {
jQuery(this).attr('src', preloadImage.src);
},
function() {
var currentSource = jQuery(this).attr('src');
jQuery(this).attr('src', imgFile);
}); // end hover
}); // end each
//insert new programming below this line
jQuery('#gallery a').click(function(evt) {
evt.preventDefault();
var imgPath = jQuery(this).attr('href');
var oldImage = jQuery('#photo img');
var newiamge = jQuery('<img src= "' +../wp-content/uploads/2019/11/slide1.png + '">');
//make new image invisible
newImage.hide();
//add to the #photo div
jQuery('#photo').prepend(newImage);
//fade in new image
newImage.fadeIn(1000);
//fade out old image and remove from DOM
oldImage.fadeOut(1000, function() {
jQuery(this).remove();
});
}); // end click
jQuery('#gallery a:first').click();
}); // end ready
</script>
.