Created
August 28, 2013 18:25
-
-
Save guillermorangel/6369468 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// page ids of all employee directory pages | |
$bond = 37; | |
$business = 30; | |
$benefits = 51; | |
$individual = 58; | |
$employee_directory = 60; | |
// get current page id | |
$current = get_the_ID(); | |
// check what page we are on and set the query arguments to the correct category | |
if ( $current == $bond ) { $conditional_cat = 'bond'; } | |
elseif ( $current == $business ) { $conditional_cat = 'business'; } | |
elseif ( $current == $benefits ) { $conditional_cat = 'benefits'; } | |
elseif ( $current == $individual ) { $conditional_cat = 'individual'; } | |
else { $conditional_cat = array('bond','business','benefits','individual'); } | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$query_args = array( | |
'order' => 'ASC', | |
'orderby' => 'title', | |
'posts_per_page' => '-1', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'employee_team', | |
'field' => 'slug', | |
'terms' => $conditional_cat | |
) | |
) | |
); | |
query_posts( $query_args ); | |
if ( have_posts() ) { | |
$count = 0; | |
while ( have_posts() ) { the_post(); $count++; | |
} // End WHILE Loop | |
} else { | |
?> | |
<article <?php post_class(); ?>> | |
<p><?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ); ?></p> | |
</article><!-- /.post --> | |
<?php } // End IF Statement ?> | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment