Created
February 23, 2012 22:22
-
-
Save kirstenkeister/1895369 to your computer and use it in GitHub Desktop.
Repeating fields for project pages
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 | |
| global $project_mb; | |
| $project_mb->the_meta(); | |
| $i = 0; | |
| while($project_mb->have_fields('links') || $project_mb->have_fields('paststaff') ) { | |
| if($i == 0) | |
| { ?> | |
| <div id="info-staff" class="column left"> | |
| <h2 class="column-title">Participating MITH Staff</h2> | |
| <ul> | |
| <?php } // endif | |
| $staffname = $project_mb->get_the_value('projectstaff'); | |
| $paststaffname = $project_mb->get_the_value('past-projectstaff'); ?> | |
| <li><a href="<?php echo get_permalink($staffname); ?>" class="c-staff-link"><?php echo get_the_title($staffname); ?></a></li> | |
| <li><a href="<?php echo get_permalink($paststaffname); ?>" class="p-staff-link"><?php echo get_the_title($paststaffname); ?></a></li> | |
| <?php $i++; } // endwhile | |
| if ($i > 0 ) { ?> | |
| </ul> | |
| </div> | |
| <?php } // endif ?> | |
| <!-- /project-staff --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you already use the the_field() command to switch fields inside of a while loop? Looking at the WP_Alchemy website, it seems that they want you to set it up so that you pull the data once (do the while $project->have_fields() one time) then switch between data fields by either the_field or the_value calls.
If that isn't working, what I would suggest is that we take a look at your data model and see if it's not satisfying what you're asking it. Sometimes the issue with my stuff is that I design the data for one purpose, then find that I query for something totally different and have to go back and re-design the database. It's painful, but pays off in the long run.