Commit af383938 authored by Nahla Shiri's avatar Nahla Shiri

menu + accès pro correction

parent af6800f3
......@@ -16,7 +16,7 @@
if ( is_user_logged_in() ) { ?>
<li class="to-slide"><a href="<?php echo get_permalink(260)?>">téléchargements</a></li>
<?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>
</ul>
</div>
......
......@@ -303,6 +303,8 @@ function nap_menu() {
foreach ($all_categories as $cat) {
if ($cat->category_parent == 0) {
$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>';
$args2 = array(
......@@ -326,7 +328,16 @@ function nap_menu() {
$calss = 'active';
else
$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 @@
*
*/
$ext_ref = externe_referrer();
if($ext_ref) {
if ($ext_ref) {
get_header();
}
$current_page = 'phototheque';
if(!$ext_ref) {
if (!$ext_ref) {
$class_back = "int-link";
}
?>
......@@ -23,7 +23,7 @@ if(!$ext_ref) {
<div class="header">
<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>
<nav class = "row">
<h2 class = "crete big-title">Photothèque</h2>
......@@ -56,75 +56,102 @@ if(!$ext_ref) {
?>
<div class="gallery-wrapper right row">
<div class="panel panel-content product-list transition clearfix list-animation">
<?php foreach ($all_categories as $cat) {
if ($cat->category_parent == 0) {
$category_id = $cat->term_id;
$args2 = array(
'taxonomy' => $taxonomy,
'child_of' => 0,
'parent' => $category_id,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'hide_empty' => $empty
);
$sub_cats = get_categories($args2);
?>
<?php
if ($sub_cats) {
$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>
<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();
<?php
foreach ($all_categories as $cat) {
if ($cat->category_parent == 0) {
$category_id = $cat->term_id;
$args2 = array(
'taxonomy' => $taxonomy,
'child_of' => 0,
'parent' => $category_id,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'hide_empty' => $empty
);
$sub_cats = get_categories($args2);
?>
<?php
if ($sub_cats) {
$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>
while ($naps_posts->have_posts()) : $naps_posts->the_post();
$id = get_the_ID();
<div class="product-list">
<?php
$ambiance = array();
if (get_field('images_ambiance', 'product_cat_' . $sub_category->term_id)):
$options['size'] = 'big';
$options['image'] =
$args = array(
'post_type' => array('product', 'product_variation'),
'post_status' => array('private', 'publish'),
'numberposts' => -1,
'orderby' => 'menu_order',
'order' => 'asc',
'post_parent' => $id
);
while (has_sub_field('images_ambiance', 'product_cat_' . $sub_category->term_id)) :
$image_amb = get_sub_field('img_ab');
$ambiance [] = $image_amb;
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;
wp_reset_query();
?>
</div>
</section>
<?php
$i++;
endforeach;
}
?>
<?php
}
} //END foreach
?>
$args = array('post_type' => 'product', 'stock' => 1, 'posts_per_page' => -1, 'product_cat' => $sub_category->name, 'orderby' => 'title', 'order' => 'ASC', 'hide_empty' => 0);
$naps_posts = new WP_Query($args);
$options = array();
while ($naps_posts->have_posts()) : $naps_posts->the_post();
$id = get_the_ID();
$options['size'] = 'big';
$options['image'] = $args = array(
'post_type' => array('product', 'product_variation'),
'post_status' => array('private', 'publish'),
'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>
</div>
<?php
if($ext_ref) {
if ($ext_ref) {
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