Last active
April 12, 2018 03:53
-
-
Save jrstaatsiii/66e41eb426bca2cc78564482266c5de6 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 | |
| // Conditional Itinerary Builder Template | |
| $form_page = get_option('form_page'); | |
| $suggestions_page = get_option('suggestions_page'); | |
| $results_page = get_option('results_page); | |
| if ( is_page( $form_page ) ) { | |
| get_template_part('/templates/form-page'); | |
| } elseif ( is_page( $suggestions_page ) ) { | |
| get_template_part('/templates/suggestions-page'); | |
| } elseif ( is_page( $results_page ) ) { | |
| get_template_part('/templates/results-page'); | |
| } | |
| // WP_Query | |
| $activities = array(); | |
| if ( $entry[‘data’][‘activities’] == ‘mindfullness’ ) { | |
| $activities[] = 'mindfulness-spa-treatments'; | |
| } | |
| if ( $entry[‘data’][‘activities’] == ‘scenic_drives’ ) { | |
| $activities[] = 'scenic-drives'; | |
| } | |
| // etc | |
| $dining = array(); | |
| if ( $entry[‘data’][‘dining’] == ‘sit_down’ ) { | |
| dining[] = 'sit-down'; | |
| } | |
| args = array( | |
| 'post_type' => 'activity', | |
| 'tax_query' => array( | |
| array( | |
| 'taxonomy' => 'activity_category', | |
| 'field' => 'slug', | |
| 'terms' => $data['activities'], | |
| ), | |
| ), | |
| ); | |
| $activities = new WP_Query($args); | |
| // likely need to run a conditional to avoid NULL errors | |
| // get the ids of all matching activities | |
| $activity_ids = wp_list_pluck( $activities->posts, 'ID' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment