Advertisement
Guest User

Untitled

a guest
Mar 27th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template Name: Single Rooms Template
  4.  *
  5.  * Front Page.
  6.  */
  7.  
  8. get_header(); ?>
  9.  
  10. <?php
  11.     global $post;
  12.     $slug = get_post( $post )->post_name; /*sets the SLUG Variable, which will be matched with the attachment's meta*/
  13.     $args = array(
  14.                 'post_type' => 'attachment',
  15.                 'post_status' => 'inherit',
  16.                 'post_mime_type' => 'image',
  17.                 'posts_per_page' => 10,
  18.                 'meta_key' => '_room',
  19.                 'meta_value' => $slug
  20.     );
  21.    
  22.     $loop = new WP_Query( $args );
  23. ?>
  24.  
  25. <h1>PAGE NAME = <?php echo $slug; ?></h1>
  26.  
  27.     <div id="primary" class="content-area">
  28.         <div id="content" class="site-content" role="main">
  29.        
  30.        
  31.         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  32.        
  33.         <img src="<?php WHAT_GOES_RIGHT_HERE(); ?>">    
  34.  
  35.         <?php endwhile; /* end of the loop.*/ ?>
  36.  
  37.         </div><!-- #content -->
  38.     </div><!-- #primary -->
  39. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement