Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @package WordPress
- * @subpackage Traveler
- * @since 1.0
- *
- * Tours program
- *
- * Created by ShineTheme
- *
- */
- $list_day = get_post_meta(get_the_ID() , 'tours_program',true);
- if(!empty($list_day)):
- ?>
- <div id="accordion_tours" class="panel-group">
- <?php
- $i=0;
- foreach($list_day as $k=>$v):
- $id=rand();
- ?>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a href="#collapse-<?php echo esc_html($id) ?>" data-parent="#accordion_tours" data-toggle="collapse" class="title_program">
- <?php echo balanceTags($v['title']) ?>
- </a>
- </h4>
- </div>
- <div id="collapse-<?php echo esc_html($id) ?>" class="panel-collapse collapse <?php if($i==0)echo 'in'; ?>">
- <div class="panel-body">
- <?php echo nl2br($v['desc']) ?>
- </div>
- </div>
- </div>
- <?php $i++; endforeach; ?>
- </div>
- <?php endif; ?>
- <?php
- global $post;
- $post_id = $post->ID;
- $groupID = 8098;
- $custom_field_keys = get_post_custom_keys($groupID);
- $count = 0;
- $items = count($custom_field_keys);
- if($items){
- $set_in_order = array();
- foreach ( $custom_field_keys as $key => $fieldkey )
- {
- if (stristr($fieldkey,'field_'))
- {
- $cstm_pst_mt = get_post_meta($groupID, $fieldkey, true);
- $set_in_order[$cstm_pst_mt['order_no']] = $cstm_pst_mt['key'];
- }
- }
- }
- ksort($set_in_order);
- $items = count($set_in_order);
- if($items){
- /* here, I created a new array, which will consist of non-empty array items,
- on which length we CAN make the closing table & div tags dependent
- ($set_in_order_not_empty)
- so, we are just populating that array in this first foreach loop,
- and we are outputing the table, rows and all the html in NEXT foreach loop, line 109-130
- done over this $set_in_order_not_empty array, so that the length is consistent
- and table & div tags get output correctly and in each case (lines 124 and 126) */
- $set_in_order_not_empty = array();
- foreach ( $set_in_order as $key => $fieldkey )
- {
- $field = get_field_object($fieldkey, $post_id);
- if($field['label'] != ''){
- $other_label = $field['label'];
- }else{
- $other_label = '';
- }
- if(isset($field['value']) && is_array($field['value'])){
- $other_value = implode(",", $field['value']);
- }else{
- $other_value = $field['value'];
- }
- if($other_value != ''){ $set_in_order_not_empty[] = array("label" => $other_label, "value"=> $other_value); }
- }
- //
- ksort($set_in_order_not_empty);
- foreach ( $set_in_order_not_empty as $key => $field )
- {
- if($key == 0){ ?>
- <div class="tour_discount_info faqsec">
- <h3>FAQ</h3>
- <table border="0">
- <?php
- }
- echo '<tr><td>' . $field['label'] . '</td><td>' . $field['value']. '</td></tr>'; ?>
- <?php
- if($key == count($set_in_order_not_empty) - 1){
- ?>
- </table>
- </div>
- <?php
- }
- }
- //
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement