Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a single-teamphoto.php template loading data from a Team Photo - Custom Post Type, showing team photos with team member names below, one photo at a time, with a navigation list of available years below, for choosing the year of the team photo. Above this navigation would be a selection for toggling between Men's or Women's photos, within that same sport.

(This template will load after a search is performed for a player name.)

Each of the CPT posts contain a photo, team member names, and taxonomies for both gender and sport.

I'm storing those variables using:

<?php
$team_gender = strip_tags( get_the_term_list($post->ID, 'teamgender') );
$currentGender = $team_gender;
?>
<?php
$term_sport = strip_tags( get_the_term_list($post->ID, 'teamsport') );
$currentSport = $term_sport;
?>

The query I'm currently using for the navigation list of years at the bottom is:

<?php
$teamposts = get_posts('post_type=teamphoto&teamsport=' . $currentSport . '&teamgender=' . $currentGender . '&numberposts=-1&orderby=title&order=asc');
foreach($teamposts as $post) :
setup_postdata($post); ?>

<li<?php if ( $post->ID == $wp_query->post->ID ) { echo ' class="current"'; } else {} ?>>                               
<a href="<?php the_permalink() ?>"><?php the_field('team_year'); ?></a>
</li>
<?php endforeach; ?>

Men's / Women's Toggle: I need to introduce the two buttons - to toggle between Men's and Women's team photos being displayed - still within the current sport being viewed. (Altering the initial page query). which is currently the standard:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

I'm not sure how to best accomplish the toggle between Men's / Women's photos, while still remaining inside of the current sport? Would jQuery be a good option for loading an alternate query?

My tabs for choosing men's vs women's is currently void right now:

<div id="sort-tabs">
<a href="#"><div id="sort-mens-tab"></div></a>
<a href="#"><div id="sort-womens-tab"></div></a>
</div>

Any recommendations how to best accomplish this?

Thank you, Jonathon

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.