diff --git a/functions.php b/functions.php index dbf34e3..ffd9e90 100755 --- a/functions.php +++ b/functions.php @@ -26,10 +26,92 @@ function kkHideUpdateNotice() { /* WRITE YOUR OWN FUNCTIONS BELOW /*-----------------------------------------------------------------------------------*/ +/* + + + + +wp_enqueue_style( 'kk-lightbox', get_theme_file_uri( '/css/lightbox.css' ), '', KKFW_VERSION ); + + if(get_post_meta($postid, '_gallery_layout_value', true) !== 'Fullscreen' && !is_page_template('template-homepage.php')) { + wp_enqueue_script('kk-lightbox', get_theme_file_uri( '/js/jquery.lightbox.js' ), array( 'jquery' ), KKFW_VERSION, true); + + +head: + + + + corps à la fin: + + + + + + + + +function google_jquery() { + if (!is_admin()) { + wp_deregister_script('jquery'); + wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js', false, '3.3.1'); + //wp_register_script('jquery', get_stylesheet_directory_uri() . '/js/jquery.min.js', false, '3.3.1'); + wp_enqueue_script('jquery'); + } +} +add_action('init', 'google_jquery'); +*/ + + +/*function deregister_kklightbox() { + if ( is_page_template( 'page-ce-mois-ci.php' ) ) { + wp_deregister_script('kk-lightbox'); + //wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js', false, '3.1.1'); + //wp_register_script('jquery', get_stylesheet_directory_uri() . '/js/jquery.min.js', false, '3.3.1'); + //wp_enqueue_script('jquery'); + wp_deregister_style('kk-lightbox-css'); + } +} +add_action('init', 'deregister_kklightbox'); + +function register_lightGallery() { + if ( is_page_template( 'page-ce-mois-ci.php' ) ) { + // head + wp_enqueue_style( 'lightGallery', get_stylesheet_directory_uri() . '/lightGallery/dist/css/lightgallery.min.css' ); + // jquery + + // fin + wp_enqueue_script('lightGallery', get_theme_file_uri( '/lightGallery/lib/picturefill.min.js' ), array( 'jquery' ), KKFW_VERSION, true); + wp_enqueue_script('lightGallery', get_theme_file_uri( '/lightGallery/dist/js/lightgallery-all.min.js' ), array( 'jquery' ), KKFW_VERSION, true); + wp_enqueue_script('lightGallery', get_theme_file_uri( '/lightGallery/lib/jquery.mousewheel.min.js' ), array( 'jquery' ), KKFW_VERSION, true); + + } +} +add_action( 'wp_enqueue_scripts', 'register_lightGallery' ); +*/ + /* Returns the name of one random file from within a directory livre-d-or.php:39: */ + function register_photoSwipe() { + if ( is_page_template( 'page-ce-mois-ci.php' ) ) { + // head + wp_enqueue_style( 'photoSwipe', get_stylesheet_directory_uri() . '/photoSwipe/photoswipe.css' ); + // jquery + + // fin + wp_enqueue_style('photoSwipe', get_theme_file_uri( '/photoSwipe/default-skin/default-skin.css' ), array( 'jquery' ), KKFW_VERSION, true); + wp_enqueue_script('photoSwipe', get_theme_file_uri( '/photoSwipe/photoswipe.min.js' ), array( 'jquery' ), KKFW_VERSION, true); + wp_enqueue_script('photoSwipe', get_theme_file_uri( '/photoSwipe/photoswipe-ui-default.min.js' ), array( 'jquery' ), KKFW_VERSION, true); + + } +} +add_action( 'wp_enqueue_scripts', 'register_photoSwipe' ); + function getRandomFile($start_dir) { chdir($start_dir); @@ -359,7 +441,7 @@ function displayRetina ($file,$album) { 'height' => $size_hd[1] ); } - elseif (file_exists($file_sd)) { + if (file_exists($file_sd)) { $th_sd = true; $size_sd = getimagesize($file_sd, $info); $thumb['sd'] = array( @@ -368,7 +450,7 @@ function displayRetina ($file,$album) { 'height' => $size_sd[1] ); } - else { + if (($th_sd == false) || ($th_hd == false)) { $notfound = "../zenphoto/zp-core/images/err-imagenotfound.png"; $size_sd = getimagesize($notfound, $info); $thumb['sd'] = array( @@ -388,6 +470,8 @@ function displayRetina ($file,$album) { $standard = $thumb['hd']['url'] . ' 400w'; } +//print_r($standard); + $display = '