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){
- 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 != ''){
- if($key == 0){ ?>
- <div class="tour_discount_info faqsec">
- <h4>FAQ</h4>
- <table border="0">
- <?php
- }
- echo '<tr><td>' . $other_label . '</td><td>' . $other_value. '</td></tr>'; ?>
- <?php
- if($key == $items-1){ ?>
- <!-- here, she made closing of the tags dependent on $key variable being equal to last
- item in $items array. But that was an error, because she is using just a subset of
- $items array - subset consisting of items for which $other_value is not empty.
- But if there exists a field, and its value is empty, the condition is not fulfilled,
- the closing html tags for table and div (here on line 103 and 105) never get output,
- and so html gets broken, footer ending up inside the table for custom fields.-->
- </table>
- </div>
- <?php
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement