Commit af383938 authored by Nahla Shiri's avatar Nahla Shiri

menu + accès pro correction

parent af6800f3
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
if ( is_user_logged_in() ) { ?> if ( is_user_logged_in() ) { ?>
<li class="to-slide"><a href="<?php echo get_permalink(260)?>">téléchargements</a></li> <li class="to-slide"><a href="<?php echo get_permalink(260)?>">téléchargements</a></li>
<?php } ?> <?php } ?>
<li class="to-slide"><a href="<?php echo get_permalink(3364)?>">photothèque</a></li> <li class="<?php if( !is_user_logged_in() ) echo " login-user"; else echo " to-slide";?>"><?php if ( is_user_logged_in() ) {?><a href="<?php echo get_permalink(3364);?>">photothèque</a><?php } else echo "<a>photothèque</a>"; ?></li>
<li class="to-slide"><a href="<?php echo get_permalink(171)?>">mentions légales</a></li> <li class="to-slide"><a href="<?php echo get_permalink(171)?>">mentions légales</a></li>
</ul> </ul>
</div> </div>
......
...@@ -303,6 +303,8 @@ function nap_menu() { ...@@ -303,6 +303,8 @@ function nap_menu() {
foreach ($all_categories as $cat) { foreach ($all_categories as $cat) {
if ($cat->category_parent == 0) { if ($cat->category_parent == 0) {
$category_id = $cat->term_id; $category_id = $cat->term_id;
$nappe_sets = false;
if($category_id == 19){ $nappe_sets = true;} else { $nappe_sets = false;}
$menu.= '<li class ="parent-cat" data-page = "' . $category_id . '" data-img = "' . nap_category_image($category_id) . '"><a href="' . get_term_link($cat->slug, 'product_cat') . '">' . $cat->name . '</a>'; $menu.= '<li class ="parent-cat" data-page = "' . $category_id . '" data-img = "' . nap_category_image($category_id) . '"><a href="' . get_term_link($cat->slug, 'product_cat') . '">' . $cat->name . '</a>';
$args2 = array( $args2 = array(
...@@ -326,7 +328,16 @@ function nap_menu() { ...@@ -326,7 +328,16 @@ function nap_menu() {
$calss = 'active'; $calss = 'active';
else else
$calss = ''; $calss = '';
$menu.= '<li data-cover = "' . nap_category_image($sub_category->term_id) . '"><a class="' . $calss . '" href="#cat' . $sub_category->term_id . '">' . $sub_category->name . '</a></li>';
if($nappe_sets){
$sub_name = $sub_category->name;
}
else{
$sub_name = substr(strstr($sub_category->name," "), 1);
}
$menu.= '<li data-cover = "' . nap_category_image($sub_category->term_id) . '"><a class="' . $calss . '" href="#cat' . $sub_category->term_id . '">' . $sub_name . '</a></li>';
} }
} }
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
* *
*/ */
$ext_ref = externe_referrer(); $ext_ref = externe_referrer();
if($ext_ref) { if ($ext_ref) {
get_header(); get_header();
} }
$current_page = 'phototheque'; $current_page = 'phototheque';
if(!$ext_ref) { if (!$ext_ref) {
$class_back = "int-link"; $class_back = "int-link";
} }
?> ?>
...@@ -23,7 +23,7 @@ if(!$ext_ref) { ...@@ -23,7 +23,7 @@ if(!$ext_ref) {
<div class="header"> <div class="header">
<div class = "btn-wrapper row close-panel <?php echo $class_back ?>"> <div class = "btn-wrapper row close-panel <?php echo $class_back ?>">
<div class="pink-btn circle-btn"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><span class = "abs-center backlink">Retour</span></a></div> <div class="pink-btn circle-btn"><a href="<?php echo esc_url(home_url('/')); ?>"><span class = "abs-center backlink">Retour</span></a></div>
</div> </div>
<nav class = "row"> <nav class = "row">
<h2 class = "crete big-title">Photothèque</h2> <h2 class = "crete big-title">Photothèque</h2>
...@@ -56,75 +56,102 @@ if(!$ext_ref) { ...@@ -56,75 +56,102 @@ if(!$ext_ref) {
?> ?>
<div class="gallery-wrapper right row"> <div class="gallery-wrapper right row">
<div class="panel panel-content product-list transition clearfix list-animation"> <div class="panel panel-content product-list transition clearfix list-animation">
<?php foreach ($all_categories as $cat) { <?php
if ($cat->category_parent == 0) { foreach ($all_categories as $cat) {
$category_id = $cat->term_id; if ($cat->category_parent == 0) {
$category_id = $cat->term_id;
$args2 = array(
'taxonomy' => $taxonomy, $args2 = array(
'child_of' => 0, 'taxonomy' => $taxonomy,
'parent' => $category_id, 'child_of' => 0,
'orderby' => $orderby, 'parent' => $category_id,
'show_count' => $show_count, 'orderby' => $orderby,
'pad_counts' => $pad_counts, 'show_count' => $show_count,
'hierarchical' => $hierarchical, 'pad_counts' => $pad_counts,
'title_li' => $title, 'hierarchical' => $hierarchical,
'hide_empty' => $empty 'title_li' => $title,
); 'hide_empty' => $empty
$sub_cats = get_categories($args2); );
?> $sub_cats = get_categories($args2);
<?php ?>
if ($sub_cats) { <?php
$i=0; if ($sub_cats) {
foreach ($sub_cats as $sub_category) : $i = 0;
?> foreach ($sub_cats as $sub_category) :
<section id = "cat<?php echo $sub_category->term_id ?>"> <!--cat<?php // echo $i ?>-<?php // echo $current_page; ?>--> ?>
<h2 class="crete small-title"><?php echo $sub_category->name ?></h2> <section id = "cat<?php echo $sub_category->term_id ?>"> <!--cat<?php // echo $i ?>-<?php // echo $current_page; ?>-->
<h2 class="crete small-title"><?php echo $sub_category->name ?></h2>
<div class="product-list">
<?php
$args = array('post_type' => 'product', 'stock' => 1, 'posts_per_page' => -1, 'product_cat' => $sub_category->name, 'orderby' => 'title', 'order' => 'ASC');
$naps_posts = new WP_Query($args);
$options = array();
while ($naps_posts->have_posts()) : $naps_posts->the_post(); <div class="product-list">
$id = get_the_ID();
<?php
$ambiance = array();
if (get_field('images_ambiance', 'product_cat_' . $sub_category->term_id)):
$options['size'] = 'big'; while (has_sub_field('images_ambiance', 'product_cat_' . $sub_category->term_id)) :
$options['image'] = $image_amb = get_sub_field('img_ab');
$args = array( $ambiance [] = $image_amb;
'post_type' => array('product', 'product_variation'),
'post_status' => array('private', 'publish'),
'numberposts' => -1,
'orderby' => 'menu_order',
'order' => 'asc',
'post_parent' => $id
);
endwhile;
endif;
foreach ($ambiance as $key => $value) :
$attachment = wp_get_attachment_image_src($value, 'medium');
$hd = wp_get_attachment_image_src($value, 'full');
?>
<article class=" visible row ">
<a href="#"></a>
<figure data-bg="" class="big transition">
<div class="abs-full article-bg transition"></div>
<a class="circle-btn download-btn hidden-elem" download href="<?php echo $hd[0]; ?>"></a>
<img class="transition animated fadeIn visible" src=" <?php echo $attachment[0]; ?>" alt="<?php echo $sub_category->name; ?>" title="<?php echo $sub_category->name; ?>" >
</figure>
echo nap_get_item($id, $args, $current_page, $options); <h3 class="font-small">Ambiance <?php echo $sub_category->name; ?></h3>
</article>
<?php
endforeach;
endwhile; $args = array('post_type' => 'product', 'stock' => 1, 'posts_per_page' => -1, 'product_cat' => $sub_category->name, 'orderby' => 'title', 'order' => 'ASC', 'hide_empty' => 0);
wp_reset_query(); $naps_posts = new WP_Query($args);
?> $options = array();
</div>
</section> while ($naps_posts->have_posts()) : $naps_posts->the_post();
<?php $id = get_the_ID();
$i++;
endforeach;
} $options['size'] = 'big';
?> $options['image'] = $args = array(
<?php 'post_type' => array('product', 'product_variation'),
} 'post_status' => array('private', 'publish'),
} //END foreach 'numberposts' => -1,
?> 'orderby' => 'menu_order',
'order' => 'asc',
'post_parent' => $id
);
echo nap_get_item($id, $args, $current_page, $options);
endwhile;
wp_reset_query();
?>
</div>
</section>
<?php
$i++;
endforeach;
}
?>
<?php
}
} //END foreach
?>
</div><!-- /product-list --> </div><!-- /product-list -->
</div><!-- /product-list --> </div><!-- /product-list -->
</div> </div>
</div> </div>
<?php <?php
if($ext_ref) { if ($ext_ref) {
get_footer(); get_footer();
} }
?> ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment