%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/cwg/wp-content/themes/cwg/
Upload File :
Create Path :
Current File : //var/www/cwg/wp-content/themes/cwg/collectible-design.php

<?php

/**
 * The main template file
 * Template Name: Collectible Design
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package onepoint
 */

global $post;

// Retrieve applicable query parameters.
$search_query = isset($_GET['search']) ? sanitize_text_field($_GET['search']) : null;
$search_page  = isset($_GET['swppg']) ? absint($_GET['swppg']) : 1;

// Perform the search.
$search_results    = [];
$search_pagination = '';
if (!empty($search_query) && class_exists('\\SearchWP\\Query')) {
    $searchwp_query = new \SearchWP\Query($search_query, [
        'engine' => 'default', // The Engine name.
        'fields' => 'all',          // Load proper native objects of each result.
        'page'   => $search_page,
    ]);

    $search_results = $searchwp_query->get_results();

    $search_pagination = paginate_links(array(
        'format'  => '?swppg=%#%',
        'current' => $search_page,
        'total'   => $searchwp_query->max_num_pages,
    ));
}

get_header();

?>

<div id="primary" class="content-area">

    <!-- ROW carrousel -->
    <?php if (!isUserB2B() && !isset($_GET['category']) && !isset($_GET['artist']) ): ?>
        <section class="relative h-screen w-full">
            <?php if (have_rows('caroussel')) : ?>
                <div class="js-slider-b2c w-full h-full">
                    <?php while (have_rows('caroussel')) : the_row(); ?>
                        <div class="slide-container">
                            <?php $row_image_mobile = get_sub_field('background_mobile'); ?>
                            <?php $row_image_desktop = get_sub_field('background_desktop'); ?>
    
                            <figure>
                                <?= wp_get_attachment_image($row_image_mobile['id'], 'full', false, array('class' => 'sliderMobile'));?>
                                <?= wp_get_attachment_image($row_image_desktop['id'], 'full', false, array('class' => 'sliderDesktop'));?>
                                <figcaption class="w-full px-5 pt-6 pb-[200px] lg:pb-[210px] opacity-90 uppercase lg:px-[60px]">
                                    <p class="text-[11px] leading-5 font-medium mb-1 pb-[3px]"><?php the_sub_field('on_title'); ?></p>
                                    <h3 class="js-titleSlider h-[25px] text-[20px] leading-6 font-medium"><?php the_sub_field('firstname_artist'); ?> <?php the_sub_field('name_artist'); ?></h3>
                                    <h3 class="h-[25px] text-[20px] leading-6 font-light mb-5"><?php the_sub_field('subtitle'); ?></h3>
                                    <a href="<?php the_sub_field('link_button'); ?>" class="w-[140px] h-[40px] flex items-center justify-center text-[12px] font-light text-center border border-white"><?php the_sub_field('label_button'); ?></a>
                                </figcaption>
                            </figure>
                        </div>
                    <?php endwhile; ?>
                </div>
                <div class="js-navSlider-b2c w-full absolute uppercase lg:pl-[36px]">
                    <?php while (have_rows('caroussel')) : the_row(); ?>
                        <div class="h-10 text-[12px] font-light opacity-50 flex items-end">
                            <p class="js-titleSlider w-[100px] leading-4 flex items-end pb-[6px] h-full border-b border-white">
                                <?php the_sub_field('firstname_artist'); ?>
                                <?php if(get_sub_field('name_artist')!="") :  ?>
                                    <br>
                                <?php endif;  ?>
                                <?php the_sub_field('name_artist');  ?>
                            </p>
                        </div>
                    <?php endwhile; ?>
                </div>
            <?php endif; ?>
        </section>
    <?php endif; ?>

    <section id="main" class="site-main relative z-10" role="main">
        <?php if (!empty($search_query) && !empty($search_results)) : ?>
            <!----Should be placed when there is no carousel-->
            <div class="js-headerGap h-[51px]"></div>
            <?php foreach ($search_results as $search_result) : ?>
                <article class="page hentry search-result">
                    <?php
                    switch (get_class($search_result)) {
                        case 'WP_Post':
                            $post = $search_result;
                    ?>
                    <header class="entry-header">
                        <h2 class="entry-title">
                            <a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a>
                        </h2>
                    </header>
                    <div class="entry-summary"><?php the_excerpt(); ?></div>
                    <?php
                        wp_reset_postdata();
                        break;
                    case 'WP_User':
                    ?>
                    <header class="entry-header">
                        <h2 class="entry-title">
                            <a href="<?php echo get_author_posts_url($search_result->data->ID); ?>">
                                <?php echo esc_html($search_result->data->display_name); ?>
                            </a>
                        </h2>
                    </header>
                    <div class="entry-summary">
                        <?php echo wp_kses_post(get_the_author_meta(
                            'description',
                            $search_result->data->ID
                        )); ?>
                    </div>
                    <?php
                            break;
                    }
                    ?>
                </article>
            <?php endforeach; ?>

            <?php if ($searchwp_query->max_num_pages > 1) : ?>
                <div class="navigation pagination" role="navigation">
                    <h2 class="screen-reader-text">Results navigation</h2>
                    <div class="nav-links"><?php echo wp_kses_post($search_pagination); ?></div>
                </div>
            <?php endif; ?>
        <?php elseif (!empty($search_query) && empty($search_results)) : ?>
            <!----Should be placed when there is no carousel-->
            <div class="js-headerGap h-[51px]"></div>
            <p>No results found, please search again.</p>
        <?php else : ?>
            <?php if (isUserB2B() || isset($_GET['category']) || isset($_GET['artist'])): ?>
                <!----Should be placed when there is no carousel-->
                <div class="js-headerGap"></div>
                <div class="cwg-container-main mt-6">
                    <p class="mb-[15px] uppercase font-medium">Collectible Design</p>
                    <div class="js-productContainer mb-20">
                        <div class="js-content js-collectible-container w-full grid grid-cols-2 gap-3 grid-rows-2 lg:gap-10 lg:grid-cols-4">
                            <?php
                            $args = array(
                                'post_per_page' => '20'
                            );
                            get_collectibles($args);
                            ?>
                        </div>
                        <div class="js-loader hidden">
                            <div class="mx-auto flex items-center w-10 h-10 mt-12">
                                <?php include(locate_template('/assets/img/loader.svg')); ?>
                            </div>
                        </div>
                    </div>
                </div>
            <?php else : ?>
                <div class="cwg-container-main mt-8">
                    <h2 class="h-[24px] text-[16px] leading-6 font-medium uppercase">ALL Collectible Design</h2>
                    <p class="h-[19px] text-[16px] leading-6 font-light uppercase mb-6 text-grey-textLight">Iconic artworks</p>
                    <div class="js-productContainer mb-8">
                        <div class="js-content collectiblesCat">
                            
                            <?php
                                $taxonomyName = "product_cat";
                                //This gets top layer terms only. This is done by setting parent to 0.  
                                $terms = get_terms( $taxonomyName, array( 'parent' => get_term_by( 'slug', 'work', 'product_cat' )->term_id, 'orderby' => 'slug', 'hide_empty' => false ) );

                                foreach ( $terms as $term ) {
                                $thumbnail_id = get_term_meta( $term->term_id, 'thumbnail_id', true );
                                ?>
                                    <a href="?category[]=<?= $term->term_id ?>">
                                        <?php if (!empty($thumbnail_id)) {
                                            echo wp_get_attachment_image($thumbnail_id, 'full', false, array('class' => ''));
                                        }?>
                                        <div>
                                            <h3><?= $term->name ?></h3>
                                        </div>
                                    </a>
                                <?php }
                            ?> 
                        </div>
                        <div class="js-loader hidden">
                            <div class="mx-auto flex items-center w-10 h-10 mt-12">
                                <?php include(locate_template('/assets/img/loader.svg')); ?>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endif; ?>
        <?php endif; ?>
    </section> <!-- .site-main -->
</div> <!-- .content-area -->

<?php

get_footer();

?>

Zerion Mini Shell 1.0