Eliminate duplicates in a foreach loop [closed]

Use array_unique() <?php foreach($users as $user) { $states[] = get_cimyFieldValue($user->ID, ‘STATE’); // Grabing their state from their profile page } $states = array_unique($states); ?> <div class=”state”> <input type=”hidden” name=”search_type” value=”members”> <select id=”stateDrop” name=”state”> <option value=”name”>State</option> <?php foreach($states as $state) { echo ‘<option value=”‘.$state.'”>’.$state.'</option>’; } ?> </select> </div>

Search result page – display values from the result’s metaboxes

You just need to get the data using get_post_meta(). <h1><a href=”https://wordpress.stackexchange.com/questions/185685/<?php echo get_permalink()?>”><?php the_title(); ?></a></h1> <span class=”description”> <?php echo get_post_meta( get_the_ID(), ‘mobile_adv_service_desc’, true ); ?> </span> This Plugin stores your values as WordPress metadata. So to retrieve the values in the frontend, you can use the built in WordPress functions for that.

Filter posts by multiple checkbox categories

I thing, you should use this code for filter the check box category <?php // cat 42=Laos cat 57=2-4Days <?php $my_query_1 = new WP_query(array(‘category__and’ => array(42,57))); ?> <?php while ($my_query_1->have_posts()) : $my_query_1->the_post(); ?> <a href=”https://wordpress.stackexchange.com/questions/100169/<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?><?php the_excerpt(); ?></a> <?php endwhile; ?>

Advanced WordPress search form based on custom taxonomy and custom meta value

I’ve recently developed a plugin that can support the custom taxonomy element of this problem. The plugin creates select boxes for each of your custom taxonomy terms and throws the results onto a custom results page (of your choosing): Advanced Custom Post Search It currently doesn’t support custom meta values if this is something you … Read more

WordPress search form and input type=”image”

You have to use javascript or jQuery for this form. You can use like this: <!– Custom Style for the form –> <style type=”text/css”> body { margin: 0; padding: 30px 0; font-family: arial; font-size: 16px; line-height: 22px; max-width: 800px; margin: 0 auto; overflow: hidden; } body:after { content: ”; clear: both; display: table; } img{ … Read more