Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2014-02-19
1
Medium Priority
?
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
axessJosh earned 0 total points
ID: 39871726
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

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 automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
Suggested Courses

609 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