ACC SHELL
<?php
/**
* The template for displaying all single posts and attachments
*
* @package WordPress
* @subpackage Laboserv2020
* @since Laboserv2020 1.0
*/
get_header(); ?>
<?php $postID = get_the_ID();
?>
<div class="single-page">
<div class="breadcrumbs">
<div class="content">
<?php
$breadcrumbs_content = '<ul>
<li><a href="'.esc_url( home_url( '/' ) ).'">Hlavní stránka</a></li>';
$categories = get_the_category( $postID );
foreach( $categories as $cat )
{
$category_name = $cat->name;
$category_slug = $cat->slug;
$category_ID = $cat->cat_ID;
$category_link = get_category_link( $cat );
$breadcrumbs_content .= '<li><a href="'.$category_link.'">'.ucfirst( $cat->name ).'</a></li>';
}
$breadcrumbs_content .= '<li>'.get_the_title( $postID ).'</li>
</ul>';
echo $breadcrumbs_content;
?>
</div><!-- .content END -->
</div><!-- .breadcrumbs END -->
<article class="single <?php echo $category_slug; ?>">
<div class="content">
<header>
<?php
echo '<h1>'.get_the_title( $postID ).'</h1>';
if ( ! strcmp( $category_slug, 'nabidka-mesice' ) )
{
echo '<h2>'.get_field( 'subtitle', $postID ).'</h2>';
}
if ( ! strcmp( $category_slug, 'poradna' ) )
{
echo '<h2>'.get_the_date( 'j. F Y', $postID ).'</h2>';
}
echo '<p class="excerpt">'.get_the_excerpt( $postID ).'</p>';
if ( ! strcmp( $category_slug, 'poradna' ) )
{
$author = get_field( 'author', $postID );
$big_photo = get_field( 'big_photo', $postID );
echo '<p class="author">'.$author.'</p>';
if ( isset( $big_photo[ 'url' ] ) )
{
echo '<img src="'.$big_photo[ 'url' ].'" alt="'.$author.'" class="person" />';
}
/*
if ( has_post_thumbnail( $adviceID ) )
{
echo '<img src="'.get_the_post_thumbnail_url( $adviceID, 'adviceperson').'" alt="'.get_field( 'author', $postID ).'" class="person" />';
}
*/
echo '<a class="category-link" href="'.$category_link.'">prohlédněte si další příspěvky z rubriky <strong>Poradna</strong></a>';
}
?>
</header>
<?php if ( ! strcmp( $category_slug, 'nabidka-mesice' ) ) : ?>
<div class="left-col">
<img src="<?php
echo get_the_post_thumbnail_url( $postID, 'offerthmb');
?>" alt="ilustrační obrázek <?php echo get_the_title( $postID ); ?>" />
<?php
$lshop_link = get_field( 'lshop_link', $postID );
if ( isset( $lshop_link ) && ! empty( $lshop_link ) )
{
echo '<a href="'.$lshop_link.'" class="lshop-link"><strong>Objednejte<br/>on-line</strong><br/>na lshop.cz</a>';
}
?>
<div class="description">
<?php
echo get_field( 'description', $postID );
?>
</div><!-- .description END -->
</div><!-- .left-col END -->
<?php endif; ?>
<div class="post-content">
<?php echo get_the_content( $postID ); ?>
</div>
</div>
<?php
if ( ! strcmp( $category_slug, 'poradna' ) )
{
if ( get_field( 'advice_product', $postID ) )
{
echo '<section class="advice-product"><div class="content">';
echo '<div class="left-col-product">';
$lshop_link = get_field( 'lshop_link', $postID );
if ( isset( $lshop_link ) && ! empty( $lshop_link ) )
{
echo '<a href="'.$lshop_link.'" class="lshop-link"><strong>Objednejte<br/>on-line</strong><br/>na lshop.cz</a>';
}
$first_picture = get_field( 'first_picture', $postID );
if ( isset( $first_picture ) && is_array( $first_picture ) && isset( $first_picture[ 'sizes' ][ 'offerthmb' ] ) )
{
echo '<img src="'.$first_picture[ 'sizes' ][ 'offerthmb' ].'" alt="'.$first_picture[ 'alt' ].'" />';
}
$second_picture = get_field( 'second_picture', $postID );
if ( isset( $second_picture ) && is_array( $second_picture ) && isset( $second_picture[ 'sizes' ][ 'offerthmb' ] ) )
{
echo '<img src="'.$second_picture[ 'sizes' ][ 'offerthmb' ].'" alt="'.$second_picture[ 'alt' ].'" />';
}
echo '</div><!-- .left-col-product -->';
echo '<div class="product-content">'.get_field( 'product_description', $postID ).'</div>';
echo '</div></section>';
}
echo '<section class="advice-form">
<div class="content">
<h1>Poslat dotaz</h1>';
//[ninja_form id=4]
echo do_shortcode( '[ninja_form id=4]' );
echo '</div><!-- .content END -->
</section><!-- .advice-form END -->';
}
?>
</article>
<?php
if ( ! strcmp( $category_slug, 'nabidka-mesice' ) ) : ?>
<section class="other-offers">
<div class="content">
<h1>Další nabídky měsíce</h1>
<?php
$args = array(
'category' => $category_ID,
'orderby' => 'post_date',
'order' => 'ASC'
);
//echo $category_ID;
$posts = get_posts( $args );
// get IDs of posts retrieved from get_posts
$ids = array();
foreach ( $posts as $thepost ) {
$ids[] = $thepost->ID;
}
$thisindex = array_search( $postID, $ids );
$prevID = isset( $ids[ $thisindex - 1 ] ) ? $ids[ $thisindex - 1 ] : 0;
$nextID = isset( $ids[ $thisindex + 1 ] ) ? $ids[ $thisindex + 1 ] : 0;
if ( $prevID )
{
echo '<article class="prev"><a href="'.get_the_permalink( $prevID ).'" class="prev-link"></a><a href="'.get_the_permalink( $prevID ).'"><img src="'.get_the_post_thumbnail_url( $prevID, 'productthmb').'" alt="ilustrační obrázek '.get_the_title( $prevID ).'" /></a>
<header>
<span>
<h1><a href="'.get_the_permalink( $prevID ).'">'.get_the_title( $prevID ).'</a></h1>
<h2>'.get_field( 'subtitle', $prevID ).'</h2>
</span>
</header>
</article>';
}
if ( $nextID )
{
echo '<article class="next">
<header>
<span>
<h1><a href="'.get_the_permalink( $nextID ).'">'.get_the_title( $nextID ).'</a></h1>
<h2>'.get_field( 'subtitle', $nextID ).'</h2>
</span>
</header>
<a href="'.get_the_permalink( $nextID ).'"><img src="'.get_the_post_thumbnail_url( $nextID, 'productthmb').'" alt="ilustrační obrázek '.get_the_title( $nextID ).'" /></a>
<a href="'.get_the_permalink( $nextID ).'" class="next-link"></a>
</article>';
}
?>
</div>
</section>
<?php endif; ?>
<?php if ( strcmp( $category_slug, 'nabidka-mesice' ) && strcmp( $category_slug, 'poradna' ) ) : ?>
<section class="other-news">
<div class="content">
<?php
$args = array(
'category' => $category_ID,
'orderby' => 'post_date',
'order' => 'ASC'
);
//echo $category_ID;
$posts = get_posts( $args );
// get IDs of posts retrieved from get_posts
$ids = array();
foreach ( $posts as $thepost ) {
$ids[] = $thepost->ID;
}
$thisindex = array_search( $postID, $ids );
$prevID = isset( $ids[ $thisindex - 1 ] ) ? $ids[ $thisindex - 1 ] : 0;
$nextID = isset( $ids[ $thisindex + 1 ] ) ? $ids[ $thisindex + 1 ] : 0;
if ( $prevID )
{
echo '<article class="prev"><a href="'.get_the_permalink( $prevID ).'" class="prev-link"></a>
<header>
<span>
<h1><a href="'.get_the_permalink( $prevID ).'">'.get_the_title( $prevID ).'</a></h1>
<h2>Předchozí aktualita</h2>
</span>
</header>
</article>';
}
if ( $nextID )
{
echo '<article class="next">
<header>
<span>
<h1><a href="'.get_the_permalink( $nextID ).'">'.get_the_title( $nextID ).'</a></h1>
<h2>Další aktualita</h2>
</span>
</header>
<a href="'.get_the_permalink( $nextID ).'" class="next-link"></a>
</article>';
}
?>
</div><!-- .content END -->
</section><!-- .other-news END -->
<?php endif; ?>
<div class="lower-breadcrumbs">
<div class="content">
<?php echo $breadcrumbs_content; ?>
</div><!-- .content END -->
</div><!-- .lower-breadcrumbs END -->
</div><!-- .single-page END -->
<?php //get_sidebar();
get_template_part( 'supfooter' ); ?>
<?php get_footer(); ?>
ACC SHELL 2018