Advertisement
kobial8

Inline CSS Featured Image Set Up With WP Query Loop

Nov 23rd, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. <?php
  2.   $loop = new WP_Query(array('post_type' => 'slider-items', 'order' => 'DESC','posts_per_page' => 5));
  3. ?>
  4. <?php while($loop->have_posts()) : $loop -> the_post(); ?>                
  5.      <div class="item">
  6.             <div class="single-slider" style="background-image: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>')">
  7.                     <div class="slide-item-table">
  8.                         <div class="slide-item-tablecell">
  9.                             <div class="container">
  10.                                 <div class="row">
  11.                                     <h2><?php the_title(); ?></h2>
  12.                                     <?php the_content(); ?>
  13.                                     <a href="#rooms" class="btn-filled smooth-scroll">Book A Room</a>
  14.                                     <a href="#contact" class="btn-filled btn-gold smooth-scroll">contact us</a>
  15.                                 </div>
  16.                             </div>
  17.                         </div>
  18.                     </div>
  19.                 </div>
  20.             </div>
  21. <?php endwhile; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement