Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form name="search" action="" method="get">
- <select name="filter">
- <?php
- $metakey = 'Colour';
- $counties = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) );
- if ($counties) {
- foreach ($counties as $filter) {
- echo "<option value=\"" . $filter . "\">" . $filter . "</option>";
- }
- }
- ?>
- <input type="submit" value="search" />
- </form>
- <?php
- $counties = $_GET['filter'];
- if ($counties) {
- $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
- $args=array(
- 'meta_value' => $counties,
- 'paged'=>$paged,
- 'offset'=>1,
- );
- query_posts($args);
- } else {
- query_posts('cat=98&orderby=rand&posts_per_page=10');
- }
- if ($counties) { ?>
- <h3>Your Search For <?php echo $counties; ?></h3>
- <?php } else { ?>
- <h3>Recently Added</h3>
- <?php }
- if (have_posts()) : while (have_posts()) : the_post();
- $event_filter = get_post_meta($post->ID, 'filter', true);
- $imagefeed = get_post_meta($post->ID, 'Image', true);
- $minprice = get_post_meta($post->ID, 'Minimum Price', true);
- $brand = get_post_meta($post->ID, 'Brand', true);
- $oldprice = get_post_meta($post->ID, 'Old Price', true);
- $permalink = get_permalink( $id );
- echo '<div class="inbox">';
- echo '<a href="'.$permalink.'">';
- echo "<img src='".$imagefeed."' return alt='".get_the_title()."'/>";
- echo '</a>';
- echo '<br>';
- echo '</a>';
- echo '<div class="textbox">';
- echo 'Merk: ' . $brand;
- echo '<br>';
- echo '<div class="homepageprijs"><span>' . '€ ' . $minprice . '</span></div>';
- if($oldprice != $minprice && intval($oldprice) > 0.00)
- echo '<span> € ' . $oldprice . '</span>' . '<br>';
- else
- echo '';
- echo '</div>';
- echo '</div>';
- endwhile;
- ?>
- </div><!-- einde postarea -->
- <?php echo $event_filter; ?>
- </div><!-- einde contentleftoverview -->
- <?php else : ?>
- <p>Sorry no results were found</p>
- <?php endif; ?>
- <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement