Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Single Rooms Template
- *
- * Front Page.
- */
- get_header(); ?>
- <?php
- global $post;
- $slug = get_post( $post )->post_name; /*sets the SLUG Variable, which will be matched with the attachment's meta*/
- $args = array(
- 'post_type' => 'attachment',
- 'post_status' => 'inherit',
- 'post_mime_type' => 'image',
- 'posts_per_page' => 10,
- 'meta_key' => '_room',
- 'meta_value' => $slug
- );
- $loop = new WP_Query( $args );
- ?>
- <h1>PAGE NAME = <?php echo $slug; ?></h1>
- <div id="primary" class="content-area">
- <div id="content" class="site-content" role="main">
- <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
- <img src="<?php WHAT_GOES_RIGHT_HERE(); ?>">
- <?php endwhile; /* end of the loop.*/ ?>
- </div><!-- #content -->
- </div><!-- #primary -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement