Displayed HTML in table does not work
-
Hey,
Some of my data contains an HTML element in the form of a link, but it is not displayed on the frontend. Is there a way to display this data?
I am using a shortcode to display data from a table.
function shortcode_oteviraci_doba() {
$table = get_field('zkusebna');
if (!empty($table)) {
$output = '<table border="0">';
if (!empty($table['caption'])) {
$output .= '<caption>' . esc_html($table['caption']) . '</caption>';
}
if (!empty($table['header'])) {
$output .= '<thead><tr>';
foreach ($table['header'] as $th) {
$output .= '<th>' . esc_html($th['c']) . '</th>';
}
$output .= '</tr></thead>';
}
$output .= '<tbody>';
foreach ($table['body'] as $tr) {
$output .= '<tr>';
foreach ($tr as $td) {
$output .= '<td>' . esc_html($td['c']) . '</td>';
}
$output .= '</tr>';
}
$output .= '</tbody></table>';
return $output;
}
return '<p>No data available.</p>';
}
add_shortcode('oteviraci_doba', 'shortcode_oteviraci_doba');
- You must be logged in to reply to this topic.