File: /home/u547966/brikov.ru/www_old_1/wp-content/themes/brikov/templates/pictures_item.php
<?php
/*
Template Name: Элемент Портфолио
*/
?>
<!DOCTYPE html>
<html>
<body class="body-index">
<?php get_header(); ?>
<?php $post_id = get_the_ID();?>
<?php $name_pictures = get_post_meta($post_id,'name_pictures', true );
$year = get_post_meta($post_id,'year', true );
$material = get_post_meta($post_id,'material', true );
$size = get_post_meta($post_id,'size', true );
$img_painting = get_post_meta($post_id,'img_painting', false );
$img_prew = get_post_meta($post_id,'img_prew', false );
$post_id = get_the_ID();
$post_i = get_ancestors($post_id,'post');
$my_posts = new WP_Query;
$myposts = $my_posts->query( array(
'post_type' => 'page',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => '-1',
'post__not_in' => array($post_id),
'post_parent' => $post_i[0]
) );
$my_posts_offset = new WP_Query;
$myposts_offset = $my_posts_offset->query( array(
'post_type' => 'page',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => '-1',
//'post__not_in' => array($post_id),
'post_parent' => $post_i[0]
) );
foreach( $myposts_offset as $pst_offset ){
//print_r($pst_offset->ID); echo "<br />";
}
$my_posts_n = new WP_Query;
$myposts_n = $my_posts_n->query( array(
'post_type' => 'page',
'orderby' => 'rand',
'order' => 'ASC',
'offset' => '2',
'posts_per_page' => '2',
'post__not_in' => array($post_id),
'post_parent' => $post_i[0]
) );
$i_link = 0;
foreach( $myposts_n as $pst_n ){
//print_r($pst_n);echo " - ";
if($i_link==0){
$nex = '<a class="hov_nav" href="'.$pst_n->guid.'" rel="next"><img src="/wp-content/themes/brikov/assets/js/clearbox/config/default/pic/right.png" /></a>';
}else{
$pre = '<a class="hov_nav" href="'.$pst_n->guid.'" rel="prev"><img src="/wp-content/themes/brikov/assets/js/clearbox/config/default/pic/left.png" /></a>';
}
$i_link = $i_link +1;
if($pst_n->guid == $post_id){
$pre_k = 1;
}
// print_r($pst_n->ID);echo " - ";
//print_r($pst_n-> post_title);echo "<br />";
}
$next_post = get_next_post();
//print_r($next_post);
$previous_post = get_previous_post();
//print_r($previous_post);
/*$nex = get_next_post_link('%link', '<img src="/wp-content/themes/brikov/assets/js/clearbox/config/default/pic/right.png" />');
$nex = str_replace( '<a ', '<a class="hov_nav" ', $nex );
$pre = get_previous_post_link('%link', '<img src="/wp-content/themes/brikov/assets/js/clearbox/config/default/pic/left.png" />');
$pre = str_replace( '<a ', '<a class="hov_nav" ', $pre );*/
?>
<div class="text-container-holder text-container-holder05 cGalleryInner">
<div class="wrap-container-holder03">
<div class="title-holder">
<h2><strong><span><em><a href="<?php the_permalink($post_i[0]); ?>"><?php print_r(get_the_title($post_i[0])); ?></a>
</em></span></strong></h2>
</div>
<div class="holder">
<div class="text-box">
<div class="vis-im">
<div id="visual">
<?php print_r($pre);?>
<?php print_r($nex);?>
<a href="<?php print_r(wp_get_attachment_url( $img_painting['0'] ));?>" rel="clearbox[gallery=74,,comment=<table id='image_gal_open'><tr><td>Название</td><td class='field2'><?php print_r($name_pictures);?></td></tr><tr><td>Год создания</td><td class='field2'><?php print_r($year);?></td></tr><tr><td>Материал, техника</td><td class='field2'><?php print_r($material);?></td></tr><tr><td>Размер картины</td><td class='field2'><?php print_r($size);?></td></tr></table>]"><img id="kartina" src="<?php print_r(wp_get_attachment_url( $img_painting['0'] ));?>" alt="Картина художника Алексея Брикова" width="407"><img id="lupa-img" src="http://www.brikov.ru/templates/default/images/lupa.png" alt="" width="" height="" style="/*width: 50px; height: 50px; bottom: 7px; left: 359px; top: 578px;*/"></a>
</div>
</div>
<div class="text">
<h1 class="cTitle"><?php single_post_title(); ?></h1>
<div class="text-holder">
<table id="image_gal">
<tbody>
<tr><td>Название</td><td class="field2"><?php print_r($name_pictures);?></td></tr>
<tr><td>Год создания</td><td class="field2"><?php print_r($year);?></td></tr>
<tr><td>Материал, техника</td><td class="field2"><?php print_r($material);?></td></tr>
<tr><td>Размер картины</td><td class="field2"><?php print_r($size);?></td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
foreach( $myposts as $pst ){
$value = get_post_meta( $pst->ID,'img_prew', false );
}
?>
<div class="text-container-holder text-container-holder06 text-container-holder02">
<div class="holder">
<div class="gallery-photo">
<a href="#" class="prev">prev</a>
<a href="#" class="next">next</a>
<div class="gallery gallery_img">
<?php
// обрабатываем результат
foreach( $myposts as $pst ){
$value = get_post_meta( $pst->ID,'img_prew', false );
?>
<a href="<?php print_r(get_the_permalink($pst->ID))?>">
<img src="<?php print_r(wp_get_attachment_url( $value['0'] ));?>" alt="">
</a>
<?
}
?>
</div>
</div>
</div>
</div>
<?
foreach( $myposts as $pst ){
$name_pictures = get_post_meta($pst->ID,'name_pictures', true );
$year = get_post_meta($pst->ID,'year', true );
$material = get_post_meta($pst->ID,'material', true );
$size = get_post_meta($pst->ID,'size', true );
$img_painting = get_post_meta($pst->ID,'img_painting', false );
?>
<a href="<?php print_r(wp_get_attachment_url( $img_painting['0'] ));?>" rel="clearbox[gallery=74,,comment=<table id='image_gal_open'><tr><td>Название</td><td class='field2'><?php print_r($name_pictures);?></td></tr><tr><td>Год создания</td><td class='field2'><?php print_r($year);?></td></tr><tr><td>Материал, техника</td><td class='field2'><?php print_r($material);?></td></tr><tr><td>Размер картины</td><td class='field2'><?php print_r($size);?></td></tr></table>]"></a>
<?php } ?>
<?php get_footer() ?>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script-->
<script src="/wp-content/themes/brikov/assets/owl.carousel.js"></script>
<script>
var owl = $('.gallery_img');
owl.owlCarousel({
items : 5,
margin: 5,
nav: true,
loop: true,
dots: false,
navText: ["", ""],
responsiveClass: true,
responsive:{
0:{
items:1,
nav:false
},
500:{
items:2,
nav:false
},
700:{
items:3,
nav:false
},
992:{
items:5,
nav:true
},
}
});
$('.prev').click(function() {
owl.trigger('prev.owl.carousel');
return false;
})
$('.next').click(function() {
owl.trigger('next.owl.carousel');
return false;
})
</script>
<script>
$(window).scroll(function(){
if ($(window).scrollTop() > 168){
if (!$('.nav-box').hasClass('sticky')) {
$('.top').fadeIn(400);
$('.nav-box').addClass('sticky');
$('#nav a').css('width', 'auto');
}
} else {
if ($('.nav-box').hasClass('sticky')) {
$('.top').fadeOut(400);
$('.nav-box').removeClass('sticky');
$('#nav a').css('width', 'auto');
}
}
});
</script>
</body>
</html>