Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <section class="section section--drink">
- <div class="container">
- <div class="row">
- <h1 class="section__title col-lg-6 col-md-6">
- <?php
- $category = get_category_by_slug('drinks');
- if($category) { ?>
- <a href="<?php echo get_category_link($category->term_id );?>"><?php echo get_category($category->term_id )->name;?></a>
- <?php }; ?>
- </h1>
- <div class="section__link col-lg-6 col-md-6">
- <img src="<?php echo get_bloginfo('template_url') ?>/images/arrow-blue.jpg" alt="">
- <?php
- $category = get_category_by_slug('drinks');
- if($category) { ?>
- <a href="<?php echo get_category_link($category->term_id );?>">The city's best wine, beer & spirits</a>
- <?php }; ?>
- </div>
- <div class="left_articles col-lg-6 col-md-6">
- <?php
- $args = array(
- 'posts_per_page' => '2',
- 'order_by' => 'post_date',
- 'order' => 'DESC',
- 'post_type' => 'post',
- 'post_status' => 'publish',
- 'category_name' => 'drinks'
- );
- $posts = get_posts( $args );
- $excluded = array();
- foreach( $posts as $key => $post ) {
- array_push($excluded, $post->ID);
- if ( $key == 0 ) { ?>
- <article class="first cf">
- <div class="article__image">
- <a href="<?php the_permalink(); ?>" class="section__image">
- <?php the_post_thumbnail( 'drink-big' ); ?>
- </a>
- </div>
- <div class="article__info">
- <div class="category">
- <?php
- $category = get_the_category( $post->ID);
- if(!empty($category)){ ?>
- <a href="<?php echo get_category_link($category[0]->term_id );?>"><?php echo $category[0]->cat_name; ?></a>
- <?php } ?>
- </div>
- <div>
- <?php the_title( '<h1 class="article__title"><a href="' . esc_url( get_permalink() ) . '" >', '</a></h1>' ); ?>
- </div>
- <p>
- <?php
- $field = get_field('post_intro', $post->ID);
- $post_intro = '';
- if (!empty($field)) {
- $post_intro = $field;
- }
- //echo $post_intro;
- ?>
- <?php echo post_string_short($post_intro, '', 20); ?>
- </p>
- </div>
- </article>
- <?php } else { ?>
- <article class="second cf">
- <div class="article__info">
- <div class="category">
- <?php
- $category = get_the_category( $post->ID);
- if(!empty($category)){ ?>
- <a href="<?php echo get_category_link($category[0]->term_id );?>"><?php echo $category[0]->cat_name; ?></a>
- <?php } ?>
- </div>
- <div>
- <?php the_title( '<h1 class="article__title"><a href="' . esc_url( get_permalink() ) . '" >', '</a></h1>' ); ?>
- </div>
- <p>
- <?php
- $field = get_field('post_intro', $post->ID);
- $post_intro = '';
- if (!empty($field)) {
- $post_intro = $field;
- }
- //echo $post_intro;
- ?>
- <?php echo post_string_short($post_intro, '', 10); ?>
- </p>
- </div>
- </article>
- <?php }
- } ?>
- </div>
- <div class="right_articles col-lg-6 col-md-6">
- <?php
- $posts = get_posts_normal_and_sponsored ('drinks', 1, 1, 0, $excluded);
- foreach( $posts as $key => $post ) {
- $sponsored_class = '';
- $span_sponsored = '';
- if ($post->is_sponsored != '') {
- $sponsored_class = 'sponsored';
- $span_sponsored = '<span>Sponsored</span>';
- }
- ?>
- <article class="cf <?php echo $sponsored_class;?>">
- <div class="article__image fl">
- <a href="<?php the_permalink(); ?>" class="section__image">
- <?php echo $span_sponsored;?>
- <?php the_post_thumbnail( 'drink-small' ); ?>
- </a>
- </div>
- <div class="article__info fl">
- <div class="category">
- <?php
- $category = get_the_category( $post->ID);
- if(!empty($category)){ ?>
- <a href="<?php echo get_category_link($category[0]->term_id );?>"><?php echo $category[0]->cat_name; ?></a>
- <?php } ?>
- </div>
- <div>
- <?php the_title( '<h1 class="article__title"><a href="' . esc_url( get_permalink() ) . '" >', '</a></h1>' ); ?>
- </div>
- <p>
- <?php
- $field = get_field('post_intro', $post->ID);
- $post_intro = '';
- if (!empty($field)) {
- $post_intro = $field;
- }
- //echo $post_intro;
- ?>
- <?php echo post_string_short($post_intro, '', 10); ?>
- </p>
- </div>
- </article>
- <?php } ?>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-12 col-md-12">
- <?php
- $category = get_category_by_slug('drinks');
- if($category) { ?>
- <a class="seemore" href="<?php echo get_category_link($category->term_id );?>">read more
- <img src="<?php echo get_bloginfo('template_url') ?>/images/img-seemore-blue.jpg" alt="">
- </a>
- <?php }; ?>
- </div>
- </div>
- </div>
- </section>
Advertisement
Add Comment
Please, Sign In to add comment