Hello,
I am currently building a wp site for a NPO. They want to have a "team" page. The team is separated in a few departments. THe structure looks somewhat like this :
Dept 1
- Employee rank 1
- Employee rank 2
- Employee rank 2 (sorted alphabetically)
Dept 2
- ...
Each employee "is" a post.
I want to make the system so it is quite easy to :
- Add an employee to any dept (that is already easy, of course).
- Change the dept the employee is attached to.
- Change the order of the departements (w/o loosing the employee attached!)
So here is what I've thought so far :
- Each dept as a category
- Employee rank and name in a custom field : rank.name so I can sort them by rank then alphabetically by name.
then I display the team on a page using the following piece of code :
global $ancestor;
$childcats = get_categories('child_of=' . $cat . '&hide_empty=1');
foreach ($childcats as $childcat) {
echo '<h2>'.category_description($childcat->cat_ID).'</h2>';
if (cat_is_ancestor_of($ancestor, $childcat->cat_ID) == false){
query_posts(array ( 'order' => 'asc', 'category__in' => array($childcat->cat_ID),'orderby' => 'meta_value', 'meta_key' => 'classement_equipe' ));
if (have_posts()) : while (have_posts()) : the_post();
echo '<div class="featured-thumbnail">'; the_post_thumbnail(); echo '</div>';
the_content(__('[+]'));
endwhile; else:
echo 'error';
endif;
}
}
The problem is I cant change the category order!!
Do you have any ideas : should I use custom post types ? Taxonomies ? more custom fields ?
Thanks a lot !