Solved

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

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

How to create your own WordPress Theme Before I begin with the theme design tutorial, I would like to give you the basics of what is required to make a WordPress Theme. The most basic WordPress theme only requires 2 files: a style.css file and an…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
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 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…

707 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