Solved

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

Posted on 2014-02-19
1
185 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
Comment Utility
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
WordPress crontrol plugin 1 37
wp-blog-header.php not found 6 55
Need to restrict access to my site 4 52
PayPal India troubles 2 47
How to install BuddyPress on your self-hosted WordPress site It’s been called everything from “social networking in a box” to “Facebook without the terms of service,” but until Feb. 16, BuddyPress was a relatively unknown outside the WordPress MU…
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 …
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…

743 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

13 Experts available now in Live!

Get 1:1 Help Now