Skip to content

Instantly share code, notes, and snippets.

@khoipro
Last active April 16, 2019 14:48
Show Gist options
  • Select an option

  • Save khoipro/0b1880ee180d1b516e2e910700b7fc78 to your computer and use it in GitHub Desktop.

Select an option

Save khoipro/0b1880ee180d1b516e2e910700b7fc78 to your computer and use it in GitHub Desktop.
your-template.php (Gravity PDF Custom Template)
<?php
/*
* Template Name: Your Template
* Version: 1.0
*/
if ( ! class_exists( 'GFForms' ) ) {
return;
}
?>
<style>
/** To setup first header, you must use @page **/
@page :first {
header: html_FirstPageHeader;
}
* {
box-sizing: border-box;
}
table {
width: 100%;
border-collapse: collapse;
}
.table-headline td {
border: none;
}
/** Table - Headline **/
.table-headline__space {
height: 25px;
}
.table-headline__bg {
background: #193e9b;
border-left: 1px solid #193e9b;
border-right: 1px solid #193e9b;
}
.table-headline__content {
color: #fff;
font-size: 18pt;
line-height: 1.5;
font-weight: 700;
text-align: center;
}
</style>
<?php
$data = $form_data['field'];
if( !empty($settings['first_header']) ) { ?>
<htmlpageheader name="FirstPageHeader">
<table class="table-header">
<tbody>
<tr>
<td class="table-header__content">
<?php echo $settings['first_header']; ?>
</td>
</tr>
</tbody>
</table>
</htmlpageheader>
<?php } ?>
<?php if( !empty($settings['your_template_top_section_headline']) ) : ?>
<table class="table-headline" width="100%">
<tbody>
<tr>
<td class="table-headline__border"></td>
</tr>
<tr>
<td class="table-headline__bg">
<table width="100%">
<tbody>
<tr>
<td class="table-headline__space"></td>
</tr>
<tr>
<td class="table-headline__content"><?php echo $settings['your_template_top_section_headline']; ?></td>
</tr>
<tr>
<td class="table-headline__space"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="table-headline__border"></td>
</tr>
</tbody>
</table>
<?php endif; ?>
<?php
// Separate next page using `<pagebreak/>`
?>
<pagebreak/>
<?php if( !empty($settings['your_template_first_term_content']) ) : ?>
<div class="container-horizontal-space"></div>
<div class="section-content-with-heading">
<div class="container">
<?php echo $settings['your_template_first_term_content']; ?>
</div>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment