%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/press.php

<?php

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

get_header();
?>

<!----Should be placed when there is no carousel-->
<div class="js-headerGap h-[51px]"></div>

<?php
if (have_posts()) {
    while (have_posts()) {
        the_post(); ?>  

    <h1 class="pl-5 md:pl-14 mb-5 md:mb-6 font-medium md:block uppercase mt-[30px]">
        Press
    </h1>

    <section class="w-full cwg-container-main mb-7">

            <div class="grid grid-cols-1 md:grid-cols-3 gap-[30px] js-press-container">
                <?php

                    $args = array(
                        'order' => 'DESC',
                        'post_type' => 'pressarticles',
                        'post_status' => 'publish',
                        'posts_per_page' => -1
                    );
                    if(isset($_GET['artist'])) {
                        $args['meta_query'] = array(
                            'relation' => 'OR',
                            array(
                                'key'         => 'artist_press',
                                'value'          => $_GET['artist'],
                                'compare'     => 'LIKE',
                            )
                            );
                    }
                    $wc_query = new WP_Query($args);

                    if ($wc_query->have_posts() > 0) :

                    foreach ($wc_query->posts as $post) :  setup_postdata($post);

                        $categories = get_the_terms($post->ID, 'press-publication');
                        if ($categories) {
                            foreach ($categories as $category) {
                                $cat_image = get_field('image', 'press-publication_' . $category->term_id);
                            }
                        }

                        $image_background = get_field('thumbnail'); 
                ?>
                <div class="w-full">
                    <a href="<?php the_permalink();?>">
                        <div class="relative">
                            <?= wp_get_attachment_image($image_background['id'], 'full', false, array('class' => 'w-full h-full object-cover img-press-brightness')); ?>

                            <div class="absolute left-[12px] bottom-[10px] w-[70%] ">
                                <?php if (!empty($cat_image)) {
                                    echo wp_get_attachment_image($cat_image['id'], 'full', false, array('class' => 'mb-2 w-auto h-3 object-cover', ));
                                }?>
                                <h2 class="uppercase text-[13px] font-light leading-4 text-white"><?php shorten_text(get_the_title(), 65) ?></h2>
                            </div>
                        </div>
                    </a>
                    <div class="pt-3 pb-5">
                        <a href="<?php the_permalink(); ?>">
                            <div class="text-[12px] font-light mb-2 lg:h-[54px]"><?php shorten_text(strip_tags(get_the_content()), 180)?> </div>
                        </a>
                        <div class="flex justify-between">
                            <i class="text-[12px] h-[15px] font-thin text-grey-textLight">
                                <?php if ($categories) : ?>
                                    By
                                    <?= $categories[0]->name; ?>
                                    -
                                <?php endif ?>
                                <?= get_the_date() ?>
                            </i>
                            <div class="js-shareBtn flex justify-between items-center text-[12px] w-[58px] h-[15px] leading-5 text-grey-dark uppercase cursor-pointer" data-link="<?= get_permalink(get_the_ID());?>">
                                <span><?php include(locate_template('/assets/img/share-black.svg')); ?></span>
                                SHARE
                            </div>
                        </div>
                    </div>
                </div>
                <?php endforeach; ?>
                <?php endif; ?>
            </div>
                
        </section>

<?php
    }
}

?>


<?php
get_footer();

Zerion Mini Shell 1.0