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 /* 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 /* Returns the name of one random file from within a directory
livre-d-or.php:39: 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) { function getRandomFile($start_dir) {
chdir($start_dir); chdir($start_dir);
@@ -359,7 +441,7 @@ function displayRetina ($file,$album) {
'height' => $size_hd[1] 'height' => $size_hd[1]
); );
} }
elseif (file_exists($file_sd)) { if (file_exists($file_sd)) {
$th_sd = true; $th_sd = true;
$size_sd = getimagesize($file_sd, $info); $size_sd = getimagesize($file_sd, $info);
$thumb['sd'] = array( $thumb['sd'] = array(
@@ -368,7 +450,7 @@ function displayRetina ($file,$album) {
'height' => $size_sd[1] 'height' => $size_sd[1]
); );
} }
else { if (($th_sd == false) || ($th_hd == false)) {
$notfound = "../zenphoto/zp-core/images/err-imagenotfound.png"; $notfound = "../zenphoto/zp-core/images/err-imagenotfound.png";
$size_sd = getimagesize($notfound, $info); $size_sd = getimagesize($notfound, $info);
$thumb['sd'] = array( $thumb['sd'] = array(
@@ -388,6 +470,8 @@ function displayRetina ($file,$album) {
$standard = $thumb['hd']['url'] . ' 400w'; $standard = $thumb['hd']['url'] . ' 400w';
} }
//print_r($standard);
$display = '<div class="album">'; $display = '<div class="album">';
$display .= '<div class="holder">'; $display .= '<div class="holder">';
$display .= '<a href="' . $fullpath . 'albums/'.$album.'/'.$file['filename'].'" title="'.date_archive($file['filename']).'" class="kk-lightbox">'; $display .= '<a href="' . $fullpath . 'albums/'.$album.'/'.$file['filename'].'" title="'.date_archive($file['filename']).'" class="kk-lightbox">';

View File

@@ -1,75 +0,0 @@
<?php get_header() ?>
<?php
$kk_parallax = kk_parallax();
$title_type = $kk_parallax[0];
$bg_title_img = $kk_parallax[1];
?>
<?php if ( post_password_required( $post ) ) {
get_template_part( 'password-form' );
} else {
?>
<!-- start main container -->
<div class="content page-content">
<?php if( $title_type == 'parallax' ) { ?>
<div id="kk-parallax-wrapper" class="kk-parallax-wrapper">
<div id="kk-parallax-bg" class="kk-parallax-bg kk-hidden">
<img id="kk-img-check" src="<?php echo esc_url( $bg_title_img ) ?>" alt="<?php echo esc_attr( $kk_parallax[2] ) ?>" />
</div>
<div id="kk-parallax-title-wrapper" class="kk-parallax-title-wrapper">
<div id="kk-parallax-title" class="page-title">
<?php the_title( '<h1>', '</h1>' ); ?>
</div>
</div>
<a id="kk-down" class="kk-down is-loading" href="#kk-to-me"></a>
</div>
<?php } ?>
<div class="content-inner-wrapper clearfix">
<span id="kk-to-me"></span>
<?php if( $title_type == 'default' ) { ?>
<div class="post-title">
<?php the_title( '<h1>', '</h1>' ); ?>
</div>
<div class="divider clear"></div>
<?php } ?>
<div class="inner-content">
<?php the_post(); ?>
<?php the_content (); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages', 'toppic' ) . '</span>',
'after' => '</div>',
'link_before' => '<span class="link-num">',
'link_after' => '</span>'
)
);
?>
</div>
</div>
<?php get_template_part('extends/footer-area') ?>
</div>
<!-- end container -->
<?php } ?>
<?php get_footer()?>

146
single-post.php Executable file
View File

@@ -0,0 +1,146 @@
<?php get_header(); ?>
<?php the_post(); ?>
<?php if(get_option('toppic_theme_blog_sidebar_single') == 'left') {
$position = 'left';
$content_position = 'right';
} else if (get_option('toppic_theme_blog_sidebar_single') == 'right') {
$position = 'right';
$content_position = 'left';
} else if (get_option('toppic_theme_blog_sidebar_single') == 'full') {
$position = 'full';
$content_position = 'none';
} else {
$position = 'right';
$content_position = 'left';
}
$kk_parallax = kk_parallax();
$title_type = $kk_parallax[0];
$bg_title_img = $kk_parallax[1];
?>
<?php if ( post_password_required( $post ) ) {
get_template_part( 'password-form' );
} else { ?>
<!-- start content wrapper -->
<div class="content">
<?php if( $title_type == 'parallax' ) { ?>
<div id="kk-parallax-wrapper" class="kk-parallax-wrapper">
<div id="kk-parallax-bg" class="kk-parallax-bg kk-hidden">
<img id="kk-img-check" src="<?php echo esc_url( $bg_title_img ) ?>" alt="<?php echo esc_attr( $kk_parallax[2] ) ?>" />
</div>
<div id="kk-parallax-title-wrapper" class="kk-parallax-title-wrapper">
<div id="kk-parallax-title" class="page-title">
<h1><?php the_title(); ?></h1>
<?php get_template_part( 'formats/single-post/post-meta' ); ?>
</div>
</div>
<a id="kk-down" class="kk-down is-loading" href="#kk-to-me"></a>
</div>
<?php } ?>
<div class="content-inner-wrapper clearfix">
<span id="kk-to-me"></span>
<?php if( $title_type == 'default' ) { ?>
<div class="post-title">
<h1><?php the_title(); ?></h1>
<?php get_template_part( 'formats/single-post/post-meta' ); ?>
</div>
<div class="divider clear"></div>
<?php } ?>
<div class="inner-content" id="<?php echo esc_attr($content_position) ?>">
<?php
$format = get_post_format();
if( false === $format ) { $format = 'standard'; }
get_template_part( 'formats/single-post/' . $format.'-single' );
?>
<?php if( $format == 'quote' ): ?>
<?php $quoteLink = get_post_meta($post->ID, '_post_quote_source_value', true); ?>
<h2 class="quote-text">
&ldquo;<?php echo get_post_meta($post->ID, '_post_quote_value', true); ?>&rdquo;
</h2>
<?php if ($quoteLink!="") {?>
<span class="quote-source">
&mdash;&nbsp;<?php echo esc_url($quoteLink) ?>
</span>
<?php } ?>
<?php else: ?>
<div class="post-entry">
<?php the_content(); ?>
</div>
<?php endif; ?>
<?php
//edit_post_link(__('Edit this entry.'));
?>
<?php if(has_tag()) { ?>
<div class="post-tags">
<h4><?php _e('Tags:','toppic'); ?></h4>
<?php the_tags('',''); ?>
</div>
<?php } ?>
<div class="post-nav">
<?php
//echo '<div class="post-nav">';
the_post_navigation( array(
'prev_text' => '<span class="nav-link-text">' . esc_html_x( 'Previous Post', 'post navigation', 'toppic-child' ) . '</span><h3 class="entry-title">%title</h3>',
'next_text' => '<span class="nav-link-text">' . esc_html_x( 'Next Post', 'post navigation', 'toppic-child' ) . '</span><h3 class="entry-title">%title</h3>',
'screen_reader_text' =>' '
) );
//echo '</div>';
//echo '<span class="clearfix"></span>';
?>
</div>
<span class="clearfix"></span>
<?php comments_template(); ?>
</div>
<!-- start widgets -->
<?php if (get_option('toppic_theme_blog_sidebar_single') != 'full') {
if(is_active_sidebar("kk-blog-sidebar")) { ?>
<div class="sidebar" id="<?php echo esc_attr($position) ?>">
<?php dynamic_sidebar("kk-blog-sidebar")?>
</div>
<?php } } ?>
<!-- end widgets -->
</div>
<?php get_template_part('extends/footer-area') ?>
</div>
<!-- end content wrapper -->
<?php } ?>
<?php get_footer(); ?>

View File

@@ -164,6 +164,13 @@ input.search-field {
border: 1px solid #ccc; border: 1px solid #ccc;
} }
. titrePhoto {
}
.legendePhoto {
}
/* Pagination (Ce. mois. ci) */ /* Pagination (Ce. mois. ci) */
.blog-pagination { .blog-pagination {
@@ -191,3 +198,60 @@ ul.paginate li a.active {
border-radius: 5px; border-radius: 5px;
} }
ul.paginate li a:hover:not(.active) {background-color: #ffbf00;} ul.paginate li a:hover:not(.active) {background-color: #ffbf00;}
/* Post Navigation */
.post-navigation .nav-links a {
color: #999999;
display: inline-block;
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
margin: 0 6px 6px 0;
padding: 2px 9px;
}
.post-navigation .nav-links a:hover {
color: #dba425;
}
.post-navigation {
margin: 0;
padding: 0;
color: #353535;
}
.post-navigation .nav-links .nav-previous {
float: left;
box-sizing: border-box;
padding-right: 0.5em;
max-width: 50%;
}
.post-navigation .nav-links .nav-next {
float: right;
box-sizing: border-box;
padding-left: 0.5em;
max-width: 50%;
}
.post-navigation .nav-links .nav-link-text {
display: block;
}
.post-navigation .nav-links .nav-previous .nav-link-text:before {
margin-right: 3px;
content: "\00AB";
}
.post-navigation .nav-links .nav-next .nav-link-text:after {
margin-left: 4px;
content: "\00BB";
}
.post-navigation .nav-links .entry-title {
margin-bottom: 5px;
}