Solved

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

Posted on 2014-02-19
1
191 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 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…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

730 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