102 lines
3.0 KiB
PHP
102 lines
3.0 KiB
PHP
<?php
|
||
/**
|
||
* The template for displaying single posts.
|
||
*
|
||
* @package Twenty_Twenty_Four
|
||
*/
|
||
|
||
if ( ! is_singular( 'post' ) ) {
|
||
get_header();
|
||
?>
|
||
<div id="primary" class="content-area">
|
||
<main id="main" class="site-main" role="main">
|
||
<?php
|
||
while ( have_posts() ) :
|
||
the_post();
|
||
get_template_part( 'template-parts/content', 'single' );
|
||
the_post_navigation();
|
||
|
||
if ( comments_open() || get_comments_number() ) {
|
||
comments_template();
|
||
}
|
||
endwhile;
|
||
?>
|
||
</main>
|
||
</div>
|
||
<?php
|
||
get_sidebar();
|
||
get_footer();
|
||
return;
|
||
}
|
||
|
||
$posts_page_id = (int) get_option( 'page_for_posts' );
|
||
$blog_url = $posts_page_id > 0 ? get_permalink( $posts_page_id ) : home_url( '/blog/' );
|
||
$test1_header_action_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : home_url( '/cart/' );
|
||
$test1_header_mode = 'link';
|
||
|
||
if ( ! $blog_url ) {
|
||
$blog_url = home_url( '/blog/' );
|
||
}
|
||
|
||
$test1_header_action_label = __( 'Корзина', 'twentytwentyfour' );
|
||
|
||
$test1_header_args = array(
|
||
'body_class' => 'test1-shared-shell test1-shared-blog-single-page',
|
||
'header_action_url' => $test1_header_action_url,
|
||
'header_action_label' => $test1_header_action_label,
|
||
'header_mode' => $test1_header_mode,
|
||
);
|
||
|
||
get_header( 'test1', $test1_header_args );
|
||
?>
|
||
|
||
<main class="site-main" role="main">
|
||
<div class="container">
|
||
<?php
|
||
while ( have_posts() ) :
|
||
the_post();
|
||
?>
|
||
<article <?php post_class( 'blog-single' ); ?>>
|
||
<div class="blog-single-head reveal">
|
||
<a class="blog-back-link" href="<?php echo esc_url( $blog_url ); ?>"><?php esc_html_e( 'Все статьи', 'twentytwentyfour' ); ?></a>
|
||
<h1 class="blog-single-title"><?php the_title(); ?></h1>
|
||
<div class="blog-meta blog-single-meta">
|
||
<time datetime="<?php echo esc_attr( get_the_date( DATE_W3C ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time>
|
||
<span><?php echo esc_html( get_the_author() ); ?></span>
|
||
<?php
|
||
$categories = get_the_category();
|
||
if ( ! empty( $categories ) ) :
|
||
?>
|
||
<span><?php echo esc_html( $categories[0]->name ); ?></span>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if ( has_post_thumbnail() ) : ?>
|
||
<div class="blog-single-media reveal reveal-delay-1"><?php the_post_thumbnail( 'full', array( 'loading' => 'eager' ) ); ?></div>
|
||
<?php endif; ?>
|
||
|
||
<div class="blog-single-content reveal reveal-delay-1">
|
||
<?php the_content(); ?>
|
||
</div>
|
||
</article>
|
||
|
||
<div class="blog-single-pagination reveal reveal-delay-2">
|
||
<?php
|
||
the_post_navigation(
|
||
array(
|
||
'prev_text' => '<span class="nav-subtitle">' . esc_html__( 'Предыдущая статья', 'twentytwentyfour' ) . '</span><span class="nav-title">%title</span>',
|
||
'next_text' => '<span class="nav-subtitle">' . esc_html__( 'Следующая статья', 'twentytwentyfour' ) . '</span><span class="nav-title">%title</span>',
|
||
)
|
||
);
|
||
?>
|
||
</div>
|
||
<?php
|
||
endwhile;
|
||
?>
|
||
</div>
|
||
</main>
|
||
|
||
<?php
|
||
get_footer( 'test1' );
|