Solved

Get list of meta values for navigation, limit to 1 each

Posted on 2014-02-19
1
188 Views
Last Modified: 2014-02-19
I am trying to build a navigation filter for a custom post type I've developed and I am building a navigation tool to filter the results by meta value used in all posts.

With the code I'm using, it displays all meta values, and in some cases repeats 4-5 times because there are 4-5 posts with that value.

I'd like to just get the list, but limit the number of times each is mentioned.

Here is what I've setup.

$ministry = $_GET['m'];
				$args=array(
  				'post_type' => $type,
				  'post_status' => 'publish',
				  'posts_per_page' => -1,
  				'caller_get_posts'=> 1,
				'meta_key' => 'ministry',
				'meta_value' => $ministry, 
				'orderby' => 'ministry', 
				'order' => 'ASC');

Open in new window


then to display

while ($my_query->have_posts()) : $my_query->the_post(); ?>
                    	<?php 
						$ministry = get_post_meta($post->ID, 'ministry', true);
						echo $ministry; ?>
                    <?php endwhile; 

Open in new window


I understand why it is doing this based on what I am asking for, but I'd like to know how to limit what its returning.

sample here:
http://onecornerstone.org/volunteer-jobs/
0
Comment
Question by:axessJosh
1 Comment
 
LVL 2

Accepted Solution

by:
axessJosh earned 0 total points
ID: 39871726
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are looking for plug-ins to add functions to your WordPress small business web site, take some time to read though this comprehensive list.  These are all the plugins I use for my customers WordPress web sites, as well as my own.  Be sure to …
I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now