since i know you guys are all experts and all heres what i got.
i have a custom taxonomy inside a custom post type
there is a page that loops through and calls all the custom post types, and displays them
then at the top there is a dropdown that needs to list all the taxonomies for those custom post types
i have the page correctly displaying them, but the problem is the dropdown displays duplicated items. code below, the first is the code displaying now. the second is what i suggest but isn't working
================ ORIGIONAL ======================
<?php
/**
Template Name: Our Work Page
*/
?>
<?php get_header(); ?>
<div id="pagePost">
<form method="post" id="clientform" action="" onsubmit="return getURL(this.url.value)">
<select name="url" id="client">
<option selected="selected">By Client</option>
<?php
$args=array(
'post_type' => 'our_work',
'post_status' => 'publish',
'order' => 'ASC',
'posts_per_page' => -1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) { ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php $text = trim(get_the_term_list( $post->ID, 'client_name')); ?>
<option value="<?php bloginfo('url'); echo "/client_name/"; echo $text; ?>"><?php echo $text;?></option>
<?php endwhile; } wp_reset_query(); ?>
</select>
<input type="submit" id="clientsubmit" value="Search" />
</form>
<?php query_posts('post_type=our_work&posts_per_page=12&orderby=rand'); // call random blog post ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="grid_5a ourWorkImgWidth">
<a href="<?php the_permalink(); ?>"><?php echo the_post_thumbnail(array(200,200,false)); ?></a>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
<?php endwhile; endif; wp_reset_query();?>
</div> <!-- end of pagePost ID -->
<?php get_footer(); ?>
============ what im tryn =============
<?php
/**
Template Name: Our Work Page
*/
?>
<?php get_header(); ?>
<div id="pagePost">
<form method="post" id="clientform" action="" onsubmit="return getURL(this.url.value)">
<select name="url" id="client">
<option selected="selected">By Client</option>
<?php
$args=array(
'post_type' => 'our_work',
'post_status' => 'publish',
'order' => 'ASC',
'posts_per_page' => -1
);
$my_query = null;
$my_query = new WP_Query($args);
$counter = 0;
if( $my_query->have_posts() ) { ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php $termArray[] = array (trim(get_the_term_list( $post->ID, 'client_name'))) ?>
<?php // $text = trim(get_the_term_list( $post->ID, 'client_name')); ?>
<?php endwhile; } wp_reset_query(); ?>
<?php for ($i = 0; $i < $termArray.count; $i++ ) {
$tempArrayValueA = $termArray[$i];
for ($j = 0; $j < $tempArray.count; $j++) {
$tempArrayValueB = $termArray[$j];
$counter++;
if ($tempArrayValueA == $tempArrayValueB) {
if ($counter <= 2) {
echo $counter;
unset($termArray[$i]);
$termArray = array_values($termArray[]);
}
}else { ?>
<option value="<?php bloginfo('url'); echo "/client_name/"; echo $termArray[i]; ?>"><?php echo $termArray[i];?></option>
<?php } // end of if
$counter = 0; // reset counter to 0 for each position in the orgiional array
} // end of for
} ?>
</select>
<input type="submit" id="clientsubmit" value="Search" />
</form>
<?php query_posts('post_type=our_work&posts_per_page=12&orderby=rand'); // call random blog post ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="grid_5a ourWorkImgWidth">
<a href="<?php the_permalink(); ?>"><?php echo the_post_thumbnail(array(200,200,false)); ?></a>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
<?php endwhile; endif; wp_reset_query();?>
</div> <!-- end of pagePost ID -->
<?php get_footer(); ?>