Post navigation

article suivant / articje précédent
This commit is contained in:
2019-01-10 11:05:40 +01:00
parent 4d9b34861c
commit b4af1c2afd
4 changed files with 296 additions and 77 deletions

View File

@@ -26,10 +26,92 @@ function kkHideUpdateNotice() {
/* WRITE YOUR OWN FUNCTIONS BELOW
/*-----------------------------------------------------------------------------------*/
/*
<link rel='stylesheet' id='kk-lightbox-css' href='http://silverbook.local/wordpress/wp-content/themes/toppic/css/lightbox.css?ver=2.7' type='text/css' media='all' />
<script type='text/javascript' src='http://silverbook.local/wordpress/wp-content/themes/toppic/js/jquery.lightbox.js?ver=2.7'></script>
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:
<link href="../dist/css/lightgallery.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
corps à la fin:
<script type="text/javascript">
$(document).ready(function(){
$('#lightgallery').lightGallery();
});
</script>
<script src="https://cdn.jsdelivr.net/picturefill/2.3.1/picturefill.min.js"></script>
<script src="../dist/js/lightgallery-all.min.js"></script>
<script src="../lib/jquery.mousewheel.min.js"></script>
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 = '<div class="album">';
$display .= '<div class="holder">';
$display .= '<a href="' . $fullpath . 'albums/'.$album.'/'.$file['filename'].'" title="'.date_archive($file['filename']).'" class="kk-lightbox">';