/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<div id="slider-container" class="grid_16"> <div id="slider"> <?php $custom_query = new WP_Query('post_type=slide&orderby=menu_order'); ?> <?php if ($custom_query->have_posts()): while ($custom_query->have_posts()): $custom_query->the_post(); ?> <?php $post_id = get_the_ID(); ?> <a href="<?php meta('slide_url'); ?>"> <?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'large'); $image_url = $image_url[0]; echo '<img src="' . $image_url . '" title="#caption-slide-' . $post_id . '"/>'; ?> </a> <?php endwhile; else: ?> <h2>Sorry...</h2> <p>No slides to display.</p> <?php endif; wp_reset_query();?> </div><!-- #slider --> <?php $custom_query = new WP_Query('post_type=slide'); ?> <?php if ($custom_query->have_posts()): while ($custom_query->have_posts()): $custom_query->the_post(); ?> <?php $post_id = get_the_ID(); ?> <div id="caption-slide-<?php echo $post_id; ?>" class="nivo-html-caption <?php $text_placement = meta('text_placement'); $class = strtolower($text_placement); echo $class; ?>"> <?php meta('slide_text'); ?> </div><!-- .nivo-html-caption --> <?php endwhile; else: ?> <h2>Sorry...</h2> <?php endif; wp_reset_query();?> <div id="slider-flowers"></div> </div><!-- #slider-container -->