Scripts and styles are true (right in the header they are there, the paths to them are spelled correctly and the files that are needed). I connect the Lightbox for the hover effect of the gallery that riveted. And then, bang, does not work, although they are loaded ... Why? This is how? Here is my code:
function lightbox_connect() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js'); wp_enqueue_script( 'jquery' ); wp_register_script( 'lightbox_js', '/wp-content/plugins/view_post_imgs/js/lightbox.js', array( 'jquery' )); wp_enqueue_script( 'lightbox_js' ); wp_register_style( 'lightbox_css', '/wp-content/plugins/view_post_imgs/css/lightbox.css'); wp_enqueue_style( 'lightbox_css' ); } add_action( 'wp_enqueue_scripts', 'lightbox_connect' ); add_action('get_fotos'); function get_fotos(){ $gt3_theme_pagebuilder = gt3_get_theme_pagebuilder(get_the_ID()); $fotos_array = $gt3_theme_pagebuilder["post-formats"]["images"]; foreach ($fotos_array as $genera_array => $foto_id_array) { foreach ($foto_id_array as $foto_id){ echo ' <a class="example-image-link" href="'.wp_get_attachment_image_url ($foto_id).'" data-lightbox="example-set" data-title="Click the right half of the image to move forward."> <img class="example-image" src="'.wp_get_attachment_image_url ($foto_id).'" alt=""/> </a> '; } } }
function new_jquery() { wp_deregister_script( 'jquery-core' ); wp_register_script( 'jquery-core', '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'); wp_enqueue_script( 'jquery' ); } add_action( 'wp_enqueue_scripts', 'new_jquery' );That's how you need to connect jquery, because by default it already exists, but the version is old. - Hardc0re