File: /var/www/clients/client0/web279/web/MTDrubik/themes/twentyseventeen/category-2.php
<?php
get_header();
$Id_category=get_query_var('cat');//id de la categorie
$Name_category=get_cat_name($Id_category);// nom de la categorie
//$cat=$_REQUEST['cat'];
?>
<section>
<div class="section_box1_frame">
<div class="container">
<div class="title_nous_sommes wow fadeInDown" data-wow-duration='1s'><?php echo $Name_category; ?></div>
<!--title_expert-->
<div class="box_produits_frame">
<?php
query_posts( 'cat='.$Id_category.'&orderby=date&order=desc');
while ( have_posts() ) : the_post();
?>
<div class="prodframe_1">
<div class="contenu_prodframe">
<div class="img_prodframe">
<?php
foreach ( get_field ( 'gallery' ) as $nextgen_gallery_id ) :
if ( $nextgen_gallery_id['ngg_form'] == 'album' ) {
$iddgalerie = $nextgen_gallery_id['ngg_id'] ; //NextGEN Gallery album
} elseif ( $nextgen_gallery_id['ngg_form'] == 'gallery' ) {
$iddgalerie = $nextgen_gallery_id['ngg_id'] ; //NextGEN Gallery gallery
}
endforeach;
/*$idgalerie = get_field('gallery');
print_r($idgalerie);
$idgalerie = $idgalerie['ngg_id'];*/
$resultats = $wpdb->get_results("select * from dr_ngg_pictures, dr_ngg_gallery where dr_ngg_pictures.galleryid = dr_ngg_gallery.gid AND galleryid = '$iddgalerie'") ;
if($iddgalerie!=""){?>
<div class="icone_gallery"><a class="ghani-<?php the_ID() ; ?>" href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/gallery.png"> </a>
</div>
<?php } ?>
<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?>"> </div>
<div class="tit_prodframe1"><?php the_title(); ?></div>
<script>
$(".ghani-<?php the_ID() ; ?>").click(function() {
$.fancybox.open([
<?php
$m=0;
foreach ( get_field ( 'gallery' ) as $nextgen_gallery_id ) :
if ( $nextgen_gallery_id['ngg_form'] == 'album' ) {
$iddgalerie = $nextgen_gallery_id['ngg_id'] ; //NextGEN Gallery album
} elseif ( $nextgen_gallery_id['ngg_form'] == 'gallery' ) {
$iddgalerie = $nextgen_gallery_id['ngg_id'] ; //NextGEN Gallery gallery
}
endforeach;
/*$idgalerie = get_field('gallery');
print_r($idgalerie);
$idgalerie = $idgalerie['ngg_id'];*/
$resultats = $wpdb->get_results("select * from dr_ngg_pictures, dr_ngg_gallery where dr_ngg_pictures.galleryid = dr_ngg_gallery.gid AND galleryid = '$iddgalerie'") ;
if($iddgalerie!=""){
foreach ($resultats as $post) {
$m++;
}}
?>
<?php
$n=0;
foreach ( get_field ( 'gallery' ) as $nextgen_gallery_id ) :
if ( $nextgen_gallery_id['ngg_form'] == 'album' ) {
$iddgalerie = $nextgen_gallery_id['ngg_id'] ; //NextGEN Gallery album
} elseif ( $nextgen_gallery_id['ngg_form'] == 'gallery' ) {
$iddgalerie = $nextgen_gallery_id['ngg_id'] ; //NextGEN Gallery gallery
}
endforeach;
/*$idgalerie = get_field('gallery');
print_r($idgalerie);
$idgalerie = $idgalerie['ngg_id'];*/
$resultats = $wpdb->get_results("select * from dr_ngg_pictures, dr_ngg_gallery where dr_ngg_pictures.galleryid = dr_ngg_gallery.gid AND galleryid = '$iddgalerie'") ;
// Parcours des resultats obtenus
if($iddgalerie!=""){
foreach ($resultats as $post) {
$n++;
?>
{
href : '<?php echo "http://www.rubikdesign.tn/".$post->path."/".$post->filename;?>',
}<?php if($n!=$m){ echo ',' ;} ?>
<?php }} ?>
], {
});
});
</script>
</div>
</div><!--col-md-2 col-sm-3 col-xs-12-->
<?php endwhile; wp_reset_query(); ?>
<div class="clear"></div>
</div>
<!--box_derniers_nv-->
</div>
<!--container-->
</div>
<!--bloc_nous_sommes-->
</section>
<?php get_footer(); ?>