Skip to content

Instantly share code, notes, and snippets.

@dn7734
Created June 8, 2017 14:57
Show Gist options
  • Save dn7734/73fb882b881a2399622e2f7464067c91 to your computer and use it in GitHub Desktop.
Save dn7734/73fb882b881a2399622e2f7464067c91 to your computer and use it in GitHub Desktop.
wp single for portfolio cpt
<?php
do_action('get_header');
get_template_part('templates/header');
?>
<?php get_template_part('templates/partials/breadcrumbs'); ?>
<?php get_template_part('templates/base'); ?>
<!-- team -->
<section id="gallery" class="section gallery-section">
<div class="content">
<div class="row">
<div class="col-md-1 hidden-sm hidden-xs">
<a title="" data-tooltip="" href="//silrada.org/silrada/" data-original-title="Повернутись до списку"><i class="fa fa-th fa-2"></i></a>
</div>
<div class="col-md-10 col-sm-12">
<h1 class="blog-post-title text-center"><?php the_title(); ?></h1>
<hr class="tall">
</div>
<div class="col-md-1 hidden-sm hidden-xs">
<?php
$prev_post = get_previous_post();
$next_post = get_next_post();
if( ! empty($prev_post) ){ ?>
<a href="<?php echo get_permalink( $prev_post->ID ); ?>" title="<?php echo $prev_post->post_title; ?>"><i class="fa fa-angle-left fa-2"> </i></a>
<?php }
if( ! empty($next_post) ){ ?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>" title="<?php echo $next_post->post_title; ?>"> <i class="fa fa-angle-right fa-2"></i></a>
<?php } ?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?php if( have_rows('gallery') ): $i=0;?>
<div class="gallery grid" style="position: relative;height: 100%;margin-bottom: 250px;">
<!-- styles for beauty gallery photo -->
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css"/>
<!-- Add the slick-theme.css if you want default styling -->
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick-theme.css"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" rel="stylesheet" type="text/css">
<?php while( have_rows('gallery') ): the_row();
$image = get_sub_field('image');
$class = 'grid-item';
$image_attributes = wp_get_attachment_image_src( $image );
?>
<div class="<?php echo $class; ?> ">
<a href="<?php echo wp_get_attachment_url( $image ); ?>" data-animation="fadeinup">
<?php
//$image = get_field('artist_feature_image');
$image_size = 'thumbnail'; // (thumbnail, medium, large, full or custom size)
if( $image ) {
echo wp_get_attachment_image( $image, $image_size );
}
?>
</a>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
<div class="col-md-8">
<?php the_content(); ?>
<ul class="portfolio-details">
<li>
<h5>Обраний варіант дизайну</h5>
<ul class="list list-skills icons list-unstyled list-inline">
<?php $terms = get_the_terms( $post->ID , 'portfolio_skills' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'portfolio_skills' );
if( is_wp_error( $term_link ) )
continue;
echo '<li><i class="fa fa-check-circle"></i> <a href="' . $term_link . '">' . $term->name . '</a></li>';
}
?>
</ul>
</li>
<li>
<h5>Місцезнаходження </h5>
<?php $terms = get_the_terms( $post->ID , 'portfolio_cat' );
foreach ( $terms as $term ) {
echo '<p>' . $term->name . '</p>';
}
?>
</li>
</ul>
</div>
</div>
<!-- ========================== Our portfolio ========================-->
<section class="our_attorney container">
<div class="title_holder">
<h4 class="text-left">Інші ради цієї області</h4>
</div>
<div class="row owl_slider">
<div id="attorney_slider">
<?php $the_query = new WP_Query(array(
'post_type' => 'portfolio',
'tax_query' => array(
array(
'taxonomy' => 'portfolio_cat',
'field' => 'slug',
'terms' => $term->slug,
),
),
)); ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="item">
<div class="attorney_member">
<div class="img_holder">
<?php the_post_thumbnail( 'post-thumb', array( 'class' => 'img-responsive' ) ); ?>
<div class="overlay transition3s">
<ul>
<li class="transition3s">
<a href="<?php the_permalink(); ?>">
<h5><?php the_title(); ?></h5>
<span><?php echo $term->name; ?><i class="fa fa-angle-right" aria-hidden="true"></i></span>
</a>
</li>
</ul>
</div>
</div> <!-- /img_holder -->
</div> <!-- /attorney_member -->
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</div> <!-- /#attorney_slider -->
<div class="customNavigation">
<a class="prev transition3s"><i class="fa fa-angle-left"></i></a>
<a class="next transition3s"><i class="fa fa-angle-right"></i></a>
</div>
</div> <!-- /owl_slider -->
</section> <!-- /our_attorney -->
</div>
</section>
<?php get_template_part('templates/base-end'); ?>
<?php get_template_part('templates/musthave'); ?>
<!-- js for beauty gallery item -->
<script type="text/javascript" src="https://npmcdn.com/isotope-layout@3.0.1/dist/isotope.pkgd.js"></script>
<script type="text/javascript" src="https://npmcdn.com/isotope-packery@2.0.0/packery-mode.pkgd.js"></script>
<script type="text/javascript" src="<?php echo get_template_directory_uri() ?>/assets/scripts/jquery.magnific-popup.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.gallery').each(function() { // the containers for all your galleries
jQuery(this).magnificPopup({
delegate: 'a', // the selector for gallery item
type: 'image',
tClose: 'Закрити (Esc)',
tLoading: 'Загрузка...',
gallery: {
enabled:true
},
image: {
tError: 'Не вдалося завантажити <a href="%url%"> Зображення</a>.' // Error message when image could not be loaded
},
ajax: {
tError: 'Не вдалося завантажити <a href="%url%"> Контент</a>.' // Error message when ajax request failed
}
});
});
jQuery('.grid').isotope({
layoutMode: 'packery',
itemSelector: '.grid-item',
packery: {
gutter: 20
}
});
});
</script>
<?php
do_action('get_footer');
get_template_part('templates/footer');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment