Skip to content

Instantly share code, notes, and snippets.

@saifsultanc
Created March 29, 2025 09:06
Show Gist options
  • Save saifsultanc/9d295918234b4072ad307ae05d9345bb to your computer and use it in GitHub Desktop.
Save saifsultanc/9d295918234b4072ad307ae05d9345bb to your computer and use it in GitHub Desktop.
gwaft_template_showhidden.php
<?php
add_filter( 'gwaft_template_output', function( $content, $slug, $name, $data, $suffixes ) {
if ( ! in_array( 'showhidden', $suffixes, true ) ) {
return $content;
}
$items = array();
foreach ( $data['form']['fields'] as $field ) {
$items[] = array(
'label' => $field->label,
'value' => $field->get_value_export( $data['entry'] ),
);
}
$data['items'] = $items;
ob_start();
?>
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA">
<tbody>
<tr>
<td>
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<?php foreach ( $items as $item ) : ?>
<tr bgcolor="#EAF2FA">
<td colspan="2">
<font style="font-family: sans-serif; font-size:12px;">
<strong><?php echo esc_html( $item['label'] ); ?></strong>
</font>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="20">&nbsp;</td>
<td>
<font style="font-family: sans-serif; font-size:12px;">
<?php echo esc_html( $item['value'] ); ?>
</font>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
</tr>
</tbody>
</table>
<?php
return ob_get_clean();
}, 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment