OK, very simple task, I'm just not good at PHP.
I have a page where I want to list some staff using a styled list. Here is the page all working fine, I just need to divide the results - http://www.themontessoripeople.co.uk/montesori/?post_type=people
I downloaded a "custom content type" plugin and added the content type of "people" and added the appropriate fields. Now I want to filter the posts I have added by the custom field called "hierarchy".
Here is how I want the page to display:
Notice in the image I have headings for each group of posts filtered by the room. The custom field "hierarchy" contains the room variables of either "management", "babies_room" and "toddlers_room".
How do I amend the code below to filter the posts by the value held within
<?php print_custom_field('hierarchy'); ?> ?
<?php $col = 1; ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php if ($col == 1) echo "<div class=\"row\">"; ?> <div class="post col<?php echo $col;?>" id="post-<?php the_ID(); ?>"> <div class="people-spacer"> <div class="people"><a class="animate" > <div class="bio"> <p class="titles"><?php the_title(); ?><br/> <span class="job"> <?php print_custom_field('job'); ?></span> </p><br /> </div> <img src="<?php print_custom_field('staff_image:to_image_src'); ?>" width="160" height="160" alt="<?php the_title(); ?>-image" /> </div> <div class="people-link-edit"><?php edit_post_link('Edit Post', ''); ?></div> </div> </div> <?php if ($col == 1) echo "</div>"; (($col==1) ? $col=2 : $col=2); ?> <?php endwhile; ?>