First commit

Nouveau theme wordpress pour clicclac.info
This commit is contained in:
2019-01-05 07:49:43 +01:00
commit a6ec321c04
11 changed files with 1520 additions and 0 deletions

242
functions.php Executable file
View File

@@ -0,0 +1,242 @@
<?php load_theme_textdomain('toppic-child', get_template_directory() . '-child/languages'); ?>
<?php
/*-----------------------------------------------------------------------------------*/
/* ENQUEUES STYLES
/*-----------------------------------------------------------------------------------*/
function kktfwp_parent_styles() {
//wp_enqueue_style( 'kk-reset', get_theme_file_uri('/css/reset.css'), array(), KKFW_VERSION );
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css', array( 'kk-icons', 'kk-reset', 'kk-default' ), wp_get_theme()->get('Version') );
}
add_action( 'wp_enqueue_scripts', 'kktfwp_parent_styles' );
/*
* Filter for disabling the update notice in admin panel
*
*/
//add_filter( 'kkHideUpdateNotice', 'kkHideUpdateNotice' );
function kkHideUpdateNotice() {
return true;
}
/*-----------------------------------------------------------------------------------*/
/* WRITE YOUR OWN FUNCTIONS BELOW
/*-----------------------------------------------------------------------------------*/
/* Returns the name of one random file from within a directory
livre-d-or.php:39:
*/
function getRandomFile($start_dir) {
chdir($start_dir);
$dir = opendir('.');
while (($myfile = readdir($dir)) !==false) {
if ($myfile != '.' && $myfile != '..' && is_file($myfile) && $myfile != 'resource.frk') {
$files[] = $myfile;
}
}
closedir($dir);
chdir('../');
srand ((float) microtime() * 10000000);
$file = array_rand($files);
return $files[$file];
}
function show_bookmark_list(){ ?>
<ul>
<?php
$args = array(
'title_before' => '<h3>',
'title_after' => '</h3>',
);
wp_list_bookmarks( $args ); ?>
</ul>
<?php
}
add_shortcode('show_bookmark_list', 'show_bookmark_list');
/*
ce-mois.php
ce-mois-ci.php
*functions.php - date_archive()
*/
function mois2 ($mois) {
switch ($mois)
{
case 00:
$mois = "00";
break;
case 1:
$mois = __('January','toppic-child');
break;
case 2:
$mois = __('February','toppic-child');
break;
case 3:
$mois = __('March','toppic-child');
break;
case 4:
$mois = __('April','toppic-child');
break;
case 5:
$mois = __('May','toppic-child');
break;
case 6:
$mois = __('June','toppic-child');
break;
case 7:
$mois = __('July','toppic-child');
break;
case 8:
$mois = __('August','toppic-child');
break;
case 9:
$mois = __('September','toppic-child');
break;
case 10:
$mois = __('October','toppic-child');
break;
case 11:
$mois = __('November','toppic-child');
break;
case 12:
$mois = __('December','toppic-child');
break;
}
return $mois;
}
/*
ce-mois-ci.php
*/
function displayRetina ($filename,$album) {
global $ppage;
if ($ppage == "1") {
$fullpath = "../../zenphoto/";
}
else {
$fullpath = "../../../zenphoto/";
}
$file = explode(".", $filename);
$thumbpath = "../zenphoto/cache/" . $album . "/";
$a = $path . $filename;
$file_sd = $thumbpath . $file[0] . "_200_thumb.jpg";
$file_hd = $thumbpath . $file[0] . "_400_thumb.jpg";
//echo $file_sd;
//echo $file_hd;
/*
$file_sd = $path . $file[0] . "_180_watermark.jpg";
$file_hd = $path . $file[0] . "_360_watermark.jpg";
*/
$th_sd = false;
$th_hd = false;
$thumb = array();
if (file_exists($file_sd)) {
$th_sd = true;
$size_sd = getimagesize($file_sd, $info);
$thumb['sd'] = array(
'url' => "../../" . $file_sd,
'width' => $size_sd[0],
'height' => $size_sd[1]
);
}
if (file_exists($file_hd)) {
$th_hd = true;
$size_hd = getimagesize($file_hd, $info);
$thumb['hd'] = array(
'url' => "../../" . $file_hd,
'width' => $size_hd[0],
'height' => $size_hd[1]
);
}
if (($th_sd == true) && ($th_hd == true)) {
$standard = $thumb['sd']['url'] . ' 200w, ' . $thumb['hd']['url'] . ' 400w';
}
elseif ($th_sd == true) {
$standard = $thumb['sd']['url'] . ' 200w';
}
elseif ($th_hd == true) {
$standard = $thumb['hd']['url'] . ' 400w';
}
$display = '<div class="album">';
$display .= '<div class="holder">';
$display .= '<a href="' . $fullpath . 'albums/'.$album.'/'.$filename.'" title="'.date_archive($filename).'" class="kk-lightbox">';
/*
$display .= '<picture data-picture data-alt="">';
$display .= '<!--[if IE 9]><video style="display: none;"><![endif]-->';
$display .= '<source class="image_standard" srcset="' . $standard . '">';
$display .= '<!--[if IE 9]></video><![endif]-->';
$display .= '<img srcset="' . $thumb['sd']['url'] . '" width="' . $thumb['sd']['width'] . '" height="' . $thumb['sd']['height'] . '"alt="">';
$display .= '</picture>';
$display .= '<img width="" height=""
src="../../../zenphoto/cache/photos-du-mois/10_2016_200_thumb.jpg"
class="" alt=""
srcset="../../../zenphoto/cache/photos-du-mois/10_2016_200_thumb.jpg 200w,
../../../zenphoto/cache/photos-du-mois/10_2016_400_thumb.jpg 400w"
sizes="(max-width: 200px) 100vw, 200px" />';
$display .= '<img width="' . $thumb['sd']['width'] . '" height="' . $thumb['sd']['height'] . '"
src="' . $thumb['sd']['url'] . '"
class="" alt=""
srcset="' . $standard . '"
sizes="(max-width: 200px) 100vw, 200px" />';
*/
$display .= "<img width='" . $thumb['sd']['width'] . "' height='" . $thumb['sd']['height'] . "' src='" . $thumb['sd']['url'] . "' class='' alt='' srcset='" . $standard . "' sizes='(max-width: 200px) 100vw, 200px' />";
$display .= '</a>';
$display .= '</div>';
$display .= '<div class="albumdesc">';
$display .= '<a href="../../zenphoto/index.php?album='.$album.'&amp;image='.$filename.'" title= "'.date_archive($filename).'" class="">';
$display .= '<span class="exif">'.date_archive($filename).'</span>';
$display .= '</a></div>';
$display .= '</div>' . "\r\n";
//echo "display: " . $display;
return $display;
}
/*
*functions.php - displayRetina() displayRetina()
*/
function date_archive ($chaine) {
$pieces = explode(".", $chaine);
$b = explode("_", $pieces[0]);
$mois = $b[0];
$an = $b[1];
$chaine = mois2($mois) . ' '. $an;
return $chaine;
}
function preprint($s, $return=false) {
$x = "<pre>";
$x .= print_r($s, 1);
$x .= "</pre>";
if ($return) return $x;
else print $x;
}