AMEEKER

Display ACF fields

Aug 15th, 2013
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. /**
  2. *
  3. * Display an tour using
  4. * Genesis column classes and ACF.
  5. *
  6. * @author Angie Meeker
  7. * @uses Advanced Custom Fields
  8. */
  9. add_action( 'genesis_post_content', 'theme_prefix_tour', 12 );
  10. function theme_prefix_tour() {
  11. if ( !is_single() )
  12. return;
  13.  
  14. // Store the tour data
  15. $tour_data = array(
  16. 'contact' => get_field('contact'),
  17. 'admission' => get_field('admission'),
  18. 'hours' => get_field('hours'),
  19. 'coaches_accepted' => get_field('coaches_accepted'),
  20. 'reservations_required' => get_field('reservations_required'),
  21. 'length_of_tour' => get_field('length_of_tour'),
  22. 'location_of_parking' => get_field('location_of_parking'),
  23. 'comp_policy' => get_field('comp_policy'),
  24. 'restrooms_available' => get_field('restrooms_available'),
  25. 'dietary_menu_available' => get_field('dietary_menu_available'),
  26. );
  27.  
  28. if ($tour_data['contact'] != '' ||
  29. $tour_data['admission'] != '' ||
  30. $tour_data['hours'] != '' ||
  31. $tour_data['coaches_accepted'] != '' ||
  32. $tour_data['reservations_required'] != '' ||
  33. $tour_data['length_of_tour'] != '' ||
  34. $tour_data['location_of_parking'] != '' ||
  35. $tour_data['comp_policy'] != '' ||
  36. $tour_data['restrooms_available'] != '' ||
  37. $tour_data['dietary_menu_available'] != '') {
  38. echo '<div class="details">Tour Information</div>';
  39. echo '<div class="location-wrap one-half first">';
  40. if ( $tour_data['contact'] ) {
  41. echo '<div class="location">' . esc_attr( $tour_data['contact'] ) . '</div>';
  42. }
  43. if ( $tour_data['admission'] ) {
  44. echo '<div class="location">' . esc_attr( $tour_data['admission'] ) . '</div>';
  45. }
  46. if ( $tour_data['hours'] ) {
  47. echo '<div class="location">' . esc_attr( $tour_data['hours'] ) . '</div>';
  48. }
  49. if ( $tour_data['coaches_accepted'] ) {
  50. echo '<div class="location">' . esc_attr( $tour_data['coaches_accepted'] ) . '</div>';
  51. }
  52. if ( $tour_data['reservations_required'] ) {
  53. echo '<div class="location">' . esc_attr( $tour_data['reservations_required'] ) . '</div>';
  54. }
  55. if ( $tour_data['length_of_tour'] ) {
  56. echo '<div class="location">' . esc_attr( $tour_data['length_of_tour'] ) . '</div>';
  57. }
  58. if ( $tour_data['location_of_parking'] ) {
  59. echo '<div class="location">' . esc_attr( $tour_data['location_of_parking'] ) . '</div>';
  60. }
  61. if ( $tour_data['comp_policy'] ) {
  62. echo '<div class="location">' . esc_attr( $tour_data['comp_policy'] ) . '</div>';
  63. }
  64. if ( $tour_data['restrooms_available'] ) {
  65. echo '<div class="location">' . esc_attr( $tour_data['restrooms_available'] ) . '</div>';
  66. }
  67. if ( $tour_data['dietary_menu_available'] ) {
  68. echo '<div class="location">' . esc_attr( $tour_data['dietary_menu_available'] ) . '</div>';
  69. }
  70. echo '</div>';
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment