I have the following code
function stock_agenda() {
$days = json_decode(file_get_contents('json_file'));
unset($days[0]);
return '<table class="table">
<thead>
<tr>
<th> Title </th>
<th>Content</th>
<th>Date</th>
</tr>
</thead>
<tbody>
'. foreach($days as $day){.'
<tr>
<td>'.$day[0].'</td>
<td>'.$day[1].'</td>
<td>'.$day[2].'</td>
</tr>
'. }.'
</tbody>
</table>' ;
}
How to I assign it to a shortcode? If I write foreach
inside the return
method I get an error.
ob_start()
andob_get_clean()
to get the buffer data. and return him...