Advertisement
devdevmaster

Untitled

Oct 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.95 KB | None | 0 0
  1. <?php
  2.  
  3.     $args = array('post_type' => 'post', 'hierarchical' => 1, 'cat' => $category[0]->term_id, 'showposts' => 10, 'orderby' => 'date', 'order' => 'DESC', 'no_found_rows' => 'true', '_shuffle_and_pick' => 8 );
  4.  
  5.     $ultimas = new WP_Query( $args );
  6.  
  7.     if( $ultimas->have_posts() ) : ?>
  8.  
  9.         <section class="bn-section bn-section--cat-galeria">
  10.             <div class="container">
  11.                 <header class="bn-header-section">
  12.                     <h2 class="bn-header-section__title">Últimas notícias</h2>
  13.                 </header>  
  14.                 <div class="owl-carousel" id="owl-carousel-categorias">
  15.  
  16.                 <?php while ( $ultimas->have_posts() ) : $ultimas->the_post();  
  17.                     $category = get_the_category();
  18.                     $value = rwmb_meta( 'cat_color', array( 'object_type' => 'term' ), $categories[0]->term_id );
  19.                     //$tipo  = get_post_type(get_the_ID());
  20.                     $titulo_destaque = get_post_meta( get_the_id(), 'subtitulo', true);?>  
  21.                
  22.                     <article class="bn-card-ultimas">
  23.                         <figure class="bn-card-ultimas__figure">
  24.                             <a href="<?php the_permalink(); ?>" class="bn-card-ultimas__link">
  25.                                 <?php thumblazy(get_the_ID(), 'thumb-400x400', 'fade thumb', get_the_title()); ?>
  26.                             </a>                          
  27.                             <?php get_template_part('templates/share'); ?>    
  28.                         </figure>
  29.                         <div class="bn-card-ultimas__legend">
  30.                             <div class="bn-card-ultimas__head">
  31.                                 <a class="bn-card-ultimas__cat" style="color: <?php echo ($value ? $value : '#ccc'); ?>" href="<?php echo get_category_link( $category[0]->term_id );?>">
  32.                                     <?php echo $category[0]->name;?>
  33.                                 </a>  
  34.                                 <div class="bn-card-ultimas__date"><i class="dot fa fa-circle" aria-hidden="true"></i><?php echo get_the_date();?></div>
  35.                             </div>
  36.                             <a href="<?php echo get_the_permalink(); ?>" title="<?php echo get_the_title(); ?>">
  37.                                 <h2 class="bn-card-ultimas__title">
  38.                                     <?php the_title(); ?>
  39.                                 </h2>
  40.                             </a>
  41.                             <a href="<?php echo get_the_permalink(); ?>" title="<?php echo $titulo_destaque; ?>">
  42.                                 <div class="bn-card-ultimas__subtitle">
  43.                                     <?php echo $titulo_destaque; ?></div>
  44.                                 </div>
  45.                             </a>
  46.  
  47.                     </article>
  48.  
  49.                 <?php endwhile; ?>
  50.  
  51.                 </div>
  52.             </div>
  53.         </section>
  54.  
  55.     <?php endif; wp_reset_postdata(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement