Filter [wpsl_stores] in state order
-
Hi Tijmen,
I have been trying to find a way to order the loop I have generated of the stores listed on my site.
I can orderby title, but I’m hoping to create an alphabetical list based on the county/state of the store. I tried zip, to no affect, although title does work, so I have hope there is a solution.
I will then be creating further lines to create a <h2> for each county/country before each output, but will likely do this with js for convenience.
Below is my loop as I have it. Any clues welcomed.
<?php $loop = new WP_Query( array( ‘post_type’ => ‘wpsl_stores’, ‘posts_per_page’ => -1, ‘orderby’=> ‘zip’, ‘order’ => ‘ASC’) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<p> <?php echo do_shortcode( ‘[wpsl_address]’ ); ?></p>
<?php endwhile; wp_reset_query(); ?>
- The topic ‘Filter [wpsl_stores] in state order’ is closed to new replies.