phototheque.php 4.8 KB
Newer Older
Nahla Shiri's avatar
Nahla Shiri committed
1 2 3 4 5
<?php
/**
 * Template Name: phototheque
 *
 */
6 7 8 9
$ext_ref = externe_referrer();
if($ext_ref) {
    get_header();
}
Nahla Shiri's avatar
Nahla Shiri committed
10
$current_page = 'phototheque';
11 12 13
if(!$ext_ref) {
    $class_back = "int-link";
}
Nahla Shiri's avatar
Nahla Shiri committed
14 15
?>
<div id="phototheque" class="clearfix container ">
imac's avatar
imac committed
16 17 18 19
    <div class="display--only-mobile">
        <div class="container-bg abs-full"></div>
        <?php get_sidebar(); ?>
    </div>
Nahla Shiri's avatar
Nahla Shiri committed
20 21 22 23 24
    <div class="phototheque-content">

        <div class="nav-phototeque container gray-bg row fixed">

            <div class="header">
25 26
                <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>
Nahla Shiri's avatar
Nahla Shiri committed
27 28 29 30 31
                </div>
                <nav class = "row">
                    <h2 class = "crete big-title">Photothèque</h2>

                    <?php include('nav-list.php'); ?>
imac's avatar
imac committed
32
                </nav>  
Nahla Shiri's avatar
Nahla Shiri committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
            </div>
        </div>


        <?php
        $taxonomy = 'product_cat';
        $orderby = 'id';
        $show_count = 0;      // 1 for yes, 0 for no
        $pad_counts = 0;      // 1 for yes, 0 for no
        $hierarchical = 1;      // 1 for yes, 0 for no  
        $title = '';
        $empty = 0;

        $args = array(
            'taxonomy' => $taxonomy,
            'orderby' => $orderby,
            'show_count' => $show_count,
            'pad_counts' => $pad_counts,
            'hierarchical' => $hierarchical,
            'title_li' => $title,
            'hide_empty' => $empty
        );
        $all_categories = get_categories($args);
imac's avatar
imac committed
56 57 58 59 60 61
        ?>
        <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;
Nahla Shiri's avatar
Nahla Shiri committed
62

imac's avatar
imac committed
63 64 65 66 67 68 69 70 71 72 73 74 75
                    $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);
                    ?> 
Nahla Shiri's avatar
Nahla Shiri committed
76
                            <?php
imac's avatar
imac committed
77 78 79 80 81 82 83 84 85 86 87 88
                            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();
Nahla Shiri's avatar
Nahla Shiri committed
89

imac's avatar
imac committed
90 91
                                while ($naps_posts->have_posts()) : $naps_posts->the_post();
                                    $id = get_the_ID();
Nahla Shiri's avatar
Nahla Shiri committed
92 93


imac's avatar
imac committed
94 95 96 97 98 99 100 101 102 103
                                    $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
                                    );
Nahla Shiri's avatar
Nahla Shiri committed
104 105


imac's avatar
imac committed
106
                                    echo nap_get_item($id, $args, $current_page, $options);
Nahla Shiri's avatar
Nahla Shiri committed
107

imac's avatar
imac committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
                                endwhile;
                                wp_reset_query();
                                ?>
                            </div> 
                        </section>
                            <?php
                            $i++;
                                endforeach;
                            }
                            ?> 
                    <?php
                }
            } //END foreach
            ?>
            </div><!-- /product-list -->
        </div><!-- /product-list -->  
Nahla Shiri's avatar
Nahla Shiri committed
124 125
    </div>
</div>
126 127 128 129 130
<?php
 if($ext_ref) {
    get_footer();
 }
 ?>