<?php
/**
* gc-pdf-gate.php
* Persistent mu-plugin — PDF opt-in gate shortcode for gothamCulture
* Deployed: 2026-05-26 Updated: 2026-05-26 (ob_start safety net)
*
* Usage: [gc_pdf_gate pdf_url="https://..." pdf_name="Guide Title"]
* On form submit: stores lead in WP options, emails Chris, redirects to PDF.
*/
// ── SHORTCODE ────────────────────────────────────────────────────────────────
add_shortcode('gc_pdf_gate', function($atts) {
$atts = shortcode_atts([
'pdf_url' => '',
'pdf_name' => 'PDF Guide',
'notify_email' => 'chris.cancialosi@gothamculture.com',
'heading' => 'Download Your Free Guide',
'subtext' => '',
'btn_label' => 'Download Now →',
], $atts);
if (!$atts['pdf_url']) return '<p>Error: no pdf_url specified.</p>';
ob_start();
?>
<div class="gc-pdf-gate" style="max-width:480px;margin:32px auto;padding:36px 32px;background:#f4f7f0;border-radius:10px;border:1px solid #dde8cc;font-family:'Lato',sans-serif;">
<h3 style="font-family:'Roboto Slab',Georgia,serif;color:#096E38;margin:0 0 10px;font-size:1.35em;line-height:1.3;"><?php echo esc_html($atts['heading']); ?></h3>
<?php if ($atts['subtext']): ?>
<p style="color:#4B4F53;margin:0 0 20px;font-size:0.95em;line-height:1.5;"><?php echo esc_html($atts['subtext']); ?></p>
<?php else: ?>
<p style="color:#4B4F53;margin:0 0 20px;font-size:0.95em;line-height:1.5;">
Enter your name and work email to get instant access to <strong><?php echo esc_html($atts['pdf_name']); ?></strong>.
</p>
<?php endif; ?>
<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" novalidate>
<input type="hidden" name="action" value="gc_pdf_gate_submit">
<input type="hidden" name="pdf_url" value="<?php echo esc_attr($atts['pdf_url']); ?>">
<input type="hidden" name="pdf_name" value="<?php echo esc_attr($atts['pdf_name']); ?>">
<input type="hidden" name="notify_email" value="<?php echo esc_attr($atts['notify_email']); ?>">
<?php wp_nonce_field('gc_pdf_gate_nonce', '_wpnonce'); ?>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:14px;">
<div>
<label style="display:block;font-weight:700;font-size:0.85em;color:#2a2d2f;margin-bottom:5px;">First Name *</label>
<input type="text" name="first_name" required autocomplete="given-name"
style="width:100%;padding:10px 12px;border:1px solid #b8c9a0;border-radius:5px;font-size:0.95em;font-family:inherit;box-sizing:border-box;">
</div>
<div>
<label style="display:block;font-weight:700;font-size:0.85em;color:#2a2d2f;margin-bottom:5px;">Last Name *</label>
<input type="text" name="last_name" required autocomplete="family-name"
style="width:100%;padding:10px 12px;border:1px solid #b8c9a0;border-radius:5px;font-size:0.95em;font-family:inherit;box-sizing:border-box;">
</div>
</div>
<div style="margin-bottom:14px;">
<label style="display:block;font-weight:700;font-size:0.85em;color:#2a2d2f;margin-bottom:5px;">Work Email *</label>
<input type="email" name="email" required autocomplete="email" placeholder="you@yourcompany.com"
style="width:100%;padding:10px 12px;border:1px solid #b8c9a0;border-radius:5px;font-size:0.95em;font-family:inherit;box-sizing:border-box;">
</div>
<div style="margin-bottom:16px;">
<label style="display:block;font-weight:700;font-size:0.85em;color:#2a2d2f;margin-bottom:5px;">Organization</label>
<input type="text" name="organization" autocomplete="organization"
style="width:100%;padding:10px 12px;border:1px solid #b8c9a0;border-radius:5px;font-size:0.95em;font-family:inherit;box-sizing:border-box;">
</div>
<button type="submit"
style="width:100%;padding:13px;background:#91C53D;color:#fff;border:none;border-radius:5px;font-weight:700;font-size:1em;cursor:pointer;font-family:inherit;letter-spacing:0.3px;transition:background 0.2s;"
onmouseover="this.style.background='#096E38'" onmouseout="this.style.background='#91C53D'">
<?php echo esc_html($atts['btn_label']); ?>
</button>
<p style="font-size:0.75em;color:#6b7075;margin:12px 0 0;text-align:center;line-height:1.4;">
We respect your privacy and won't share your information. No spam — ever.
</p>
</form>
</div>
<?php
return ob_get_clean();
});
// ── OUTPUT BUFFER: catch any remaining direct PDF links in rendered HTML ──
// Runs at template_redirect (before output), catches Elementor-rendered links
// that bypass the_content filter. Belt-and-suspenders for CDN/cache edge cases.
add_action('template_redirect', function() {
$pdf_url = 'https://gothamculture.com/wp-content/uploads/org-culture-guide-internal-dl.pdf';
$gate_url = home_url('/download-organizational-culture-guide/');
ob_start(function($html) use ($pdf_url, $gate_url) {
if (strpos($html, $pdf_url) !== false) {
$html = str_replace($pdf_url, $gate_url, $html);
}
return $html;
});
});
// ── FORM HANDLER ─────────────────────────────────────────────────────────────
add_action('admin_post_nopriv_gc_pdf_gate_submit', 'gc_pdf_gate_handle');
add_action('admin_post_gc_pdf_gate_submit', 'gc_pdf_gate_handle');
function gc_pdf_gate_handle() {
if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'gc_pdf_gate_nonce')) {
wp_die('Security check failed.', 'Error', ['response' => 403, 'back_link' => true]);
}
$pdf_url = isset($_POST['pdf_url']) ? esc_url_raw(trim($_POST['pdf_url'])) : '';
$pdf_name = isset($_POST['pdf_name']) ? sanitize_text_field($_POST['pdf_name']) : 'PDF';
$first_name = isset($_POST['first_name']) ? sanitize_text_field($_POST['first_name']) : '';
$last_name = isset($_POST['last_name']) ? sanitize_text_field($_POST['last_name']) : '';
$email = isset($_POST['email']) ? sanitize_email($_POST['email']) : '';
$organization = isset($_POST['organization']) ? sanitize_text_field($_POST['organization']) : '';
$notify = isset($_POST['notify_email']) ? sanitize_email($_POST['notify_email']) : 'chris.cancialosi@gothamculture.com';
if (!$pdf_url || !$first_name || !$email || !is_email($email)) {
wp_die('Please fill in all required fields.', 'Missing Information', ['response' => 400, 'back_link' => true]);
}
if (!empty($_POST['website'])) { wp_redirect($pdf_url); exit; }
$leads = get_option('gc_pdf_gate_leads', []);
$leads[] = [
'first_name' => $first_name,
'last_name' => $last_name,
'email' => $email,
'organization' => $organization,
'pdf' => $pdf_name,
'ts' => current_time('mysql'),
'ip' => isset($_SERVER['REMOTE_ADDR']) ? sanitize_text_field($_SERVER['REMOTE_ADDR']) : '',
'referrer' => isset($_SERVER['HTTP_REFERER']) ? esc_url_raw($_SERVER['HTTP_REFERER']) : '',
];
update_option('gc_pdf_gate_leads', array_slice($leads, -1000));
$subject = "New PDF lead: {$pdf_name}";
$body = "New download from gothamCulture.com PDF gate:\n\n"
. "Name: {$first_name} {$last_name}\n"
. "Email: {$email}\n"
. "Organization: {$organization}\n"
. "PDF: {$pdf_name}\n"
. "Time: " . current_time('mysql') . "\n"
. "IP: " . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'n/a') . "\n"
. "Referrer: " . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'direct') . "\n";
$headers = ['Content-Type: text/plain; charset=UTF-8', 'From: gothamCulture Site <noreply@gothamculture.com>'];
wp_mail($notify, $subject, $body, $headers);
wp_redirect($pdf_url);
exit;
}
Culture Transformation Consulting | Sustainable Change | gothamCulture
Organizational culture transformation is sometimes necessary and a “hard reset” is what it will take to compete in the next chapter of your organization. Enterprise transformation efforts are complex and culture plays a huge role.
The gothamCulture Culture Transformation Approach:
Download a pdf of the Culture Transformation Process infographic here .
Any number of internal or external changes can cause misalignment and warrant an organizational shift. Whether it’s a change in leadership , merger or acquisition , reorganization, or changes in the market, the impact is the same: What used to feel effortless is now an uphill battle. Many organizations know when they are in need of change. Small issues in one area or department now seem systemic. Behaviors and attitudes about work are changing. Austerity, ambiguity, and productivity issues may be permeating.
Organizations recognize when there is a need for change, even if they don’t fully understand what needs changing or where to start in order to address these issues. We help our clients take a thoughtful approach to managing and leading their organizations through a culture change in ways that mitigate risk, engage key stakeholders, and ensure the new behaviors are quickly embedded into the “way people do things” day-to-day.
Through the proven success of our change management methodology, our consultants support clients in organizational culture change by assessing readiness for the change, identifying and closing skill and knowledge gaps through training, and developing strategic communication plans to ensure a successful implementation.
Additional Resources