Connection scripts WordPress why is not working?

This is their loads, they do not work...
lightbox_connect function() {
 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/dist/js/lightbox.js', array('jquery') );
 wp_enqueue_script( 'lightbox_js' );

 wp_register_style( 'lightbox_css', '/wp-content/plugins/view_post_imgs/dist/css/lightbox.css');
 wp_enqueue_style( 'lightbox_css' );
}
add_action( 'wp_enqueue_scripts', 'lightbox_connect' );

I tried to insert into the topic itself, there they work
July 8th 19 at 16:14
1 answer
July 8th 19 at 16:16
Solution
lightbox_connect_js function() {
function my_script() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.2...');
wp_enqueue_script( 'jquery' );

wp_register_script( 'lightbox_js', '/wp-content/plugins/view_post_imgs/dist/js/lightbox.js', array('jquery') );
wp_enqueue_script( 'lightbox_js' );
}
add_action( 'wp_footer', 'my_script' );

wp_register_style( 'lightbox_css', '/wp-content/plugins/view_post_imgs/dist/css/lightbox.css');
wp_enqueue_style( 'lightbox_css' );
}
add_action( 'wp_enqueue_scripts', 'lightbox_connect_js' );
read about wp_enqueue_style() and its parameters in the wp_register_style() and create two hooks are not necessary. - cleve_Murray commented on July 8th 19 at 16:19

Find more questions by tags PHPWordPress