Advertisement
Guest User

Untitled

a guest
Mar 27th, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 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( 'post_type' => 'attachment', 'posts_per_page' => 10 );
  14.     $loop = new WP_Query( $args );
  15. ?>
  16.  
  17. <h1>PAGE NAME = <?php echo $slug; ?></h1>
  18.  
  19.     <div id="primary" class="content-area">
  20.         <div id="content" class="site-content" role="main">
  21.        
  22.        
  23.         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  24.        
  25.         <?php
  26.             $room = get_post_meta($post->ID, '_room', true);
  27.            
  28.             if ($room == $slug) {
  29.                 echo '<img src="'the_thumbnail('Large List')'" />'
  30.                 }
  31.         ?> 
  32.  
  33.         <?php endwhile; /* end of the loop.*/ ?>
  34.  
  35.         </div><!-- #content -->
  36.     </div><!-- #primary -->
  37. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement