there is a problem, now I will describe in detail. The site has a template output event through the cycle. How can I make it not through div? I attach the loop code and the code as displayed in the browser. Help me))


$html .='<div class="qodef-events-list-holder-outer '.$classes.'" '.$data_atts. '>';
        $html .='<div class="qodef-events-list-holder clearfix">';
   if($query_results->have_posts()):
            while ( $query_results->have_posts() ) : $query_results->the_post();
                $current_id = get_the_ID();
                $params['title'] = get_the_title($current_id);
                $params['date'] = get_post_meta($current_id, 'qodef_event_item_date', true);
                $params['link'] = get_post_meta($current_id, 'qodef_event_item_link', true);
                $params['target'] = get_post_meta($current_id, 'qodef_event_item_target', true);
                $params['tickets_status'] = get_post_meta($current_id, 'qodef_event_item_tickets_status', true);
                $html .= qodef_core_get_shortcode_module_template_part('events','events-list-template', '', $params);      
            endwhile;
        else:
            $html .='<p>' . esc_html__( 'Sorry, no events matched your criteria.','qodef-cpt' ) . '</p>';
        endif;  
        $html .='</div>';   
        if($show_load_more == 'yes'){
            $html .= qodef_core_get_shortcode_module_template_part('events','load-more-template', '', $params);
        } 
        wp_reset_postdata();    
        $html .='</div>';
        return $html;
<div class="qodef-events-list-holder clearfix">
<div class="qodef-event-content qodef-events267">
 ...    some code
</div>
<div class="qodef-event-content qodef-events267">
    some code
</div>
<div class="qodef-event-content qodef-events267">
    some code
</div>
</div>

The code should look something like this. Can someone help?

<div class="qodef-events-list-holder clearfix">
 <table> //start table
  <tr><div class="qodef-event-content qodef-events267">
    ... some code
      </div></tr>
 <tr><div class="qodef-event-content qodef-events268">
    ... some code
 </div></tr>
 <tr><div class="qodef-event-content qodef-events269">
    ... some code
 </div></tr>
</table> //finish table
</div>

1 Answers

0
Community On
if($query_results->have_posts()):
         $html .= '<table>';
            while ( $query_results->have_posts() ) : $query_results->the_post();
                $current_id = get_the_ID();
                $params['title'] = get_the_title($current_id);
                $params['date'] = get_post_meta($current_id, 'qodef_event_item_date', true);
                $params['link'] = get_post_meta($current_id, 'qodef_event_item_link', true);
                $params['target'] = get_post_meta($current_id, 'qodef_event_item_target', true);
                $params['tickets_status'] = get_post_meta($current_id, 'qodef_event_item_tickets_status', true);


                $html .= '<tr><td>' . qodef_core_get_shortcode_module_template_part('events','events-list-template', '', $params) . '</td></tr>';

            endwhile;
            $html .= '</table>';
        else:
            $html .='<p>' . esc_html__( 'Sorry, no events matched your criteria.','qodef-cpt' ) . '</p>';

        endif;