| 1 |
<?php |
| 2 |
/** |
| 3 |
* MetaBox template |
| 4 |
* |
| 5 |
* @package ConvertKit |
| 6 |
* @author ConvertKit |
| 7 |
*/ |
| 8 |
?> |
| 9 |
<table class="form-table"> |
| 10 |
<tbody> |
| 11 |
<?php if ( $post->ID == get_option( 'page_for_posts' ) ) : ?> |
| 12 |
<tr valign="top"> |
| 13 |
<td> |
| 14 |
<p class="description"> |
| 15 |
<?php _e( 'The ConvertKit plugin does not show forms on the blog archive page.', |
| 16 |
'convertkit' ); ?> |
| 17 |
</p> |
| 18 |
</td> |
| 19 |
</tr> |
| 20 |
<?php else : ?> |
| 21 |
<tr valign="top"> |
| 22 |
<th scope="row"><label for="wp-convertkit-form"><?php esc_html_e( 'Form', 'convertkit' ); ?></label> |
| 23 |
</th> |
| 24 |
<td> |
| 25 |
<select name="wp-convertkit[form]" id="wp-convertkit-form"> |
| 26 |
<option <?php selected( - 1, $meta['form'] ); ?> value="-1"><?php esc_html_e( 'Default', |
| 27 |
'convertkit' ); ?></option> |
| 28 |
<option <?php selected( 0, $meta['form'] ); ?> value="0"><?php esc_html_e( 'None', |
| 29 |
'convertkit' ); ?></option> |
| 30 |
<?php foreach ( $forms as $form ) { ?> |
| 31 |
<option <?php selected( $form['id'], $meta['form'] ); ?> |
| 32 |
value="<?php echo $form['id']; // WPCS: XSS ok. ?>"> |
| 33 |
<?php echo $form['name']; // WPCS: XSS ok. ?></option> |
| 34 |
<?php } ?> |
| 35 |
</select> |
| 36 |
<p class="description"> |
| 37 |
<?php |
| 38 |
/* translators: 1: settings url */ |
| 39 |
printf( __( 'Choose <code>Default</code> to use the form specified on the <a href="%s" target="_blank">settings page</a>,', |
| 40 |
'convertkit' ), esc_attr( esc_url( $settings_link ) ) ); // WPCS: XSS ok. |
| 41 |
echo __( '<code>None</code> to not display a form, or any other option to specify a particular form for this piece of content.', |
| 42 |
'convertkit' ); // WPCS: XSS ok. |
| 43 |
?> |
| 44 |
</p> |
| 45 |
|
| 46 |
<p class="description"> |
| 47 |
<?php esc_html_e( 'To make changes to your forms,', 'convertkit' ); ?> |
| 48 |
<a href="https://app.convertkit.com/" target="_blank"><?php esc_html_e( 'sign in to ConvertKit', |
| 49 |
'convertkit' ); ?></a> |
| 50 |
</p> |
| 51 |
</td> |
| 52 |
</tr> |
| 53 |
<?php if ( 'page' === $post->post_type ) { ?> |
| 54 |
<tr valign="top"> |
| 55 |
<th scope="row"><label for=""><?php esc_html_e( 'Landing Page', 'convertkit' ); ?></label></th> |
| 56 |
<td> |
| 57 |
<select name="wp-convertkit[landing_page]" id="wp-convertkit-landing_page"> |
| 58 |
<option <?php selected( '', $meta['landing_page'] ); ?> value="0"><?php _e( 'None', |
| 59 |
'convertkit' ); // WPCS: XSS ok. ?></option> |
| 60 |
<?php foreach ( $landing_pages as $landing_page ) : |
| 61 |
$name = sanitize_text_field( $landing_page['name'] ); |
| 62 |
if ( isset( $landing_page['url'] ) ) : ?> |
| 63 |
<option <?php selected( $landing_page['url'], $meta['landing_page'] ); ?> |
| 64 |
value="<?php echo esc_attr( $landing_page['url'], |
| 65 |
'convertkit' ); ?>"><?php echo esc_attr( $name ); ?></option> |
| 66 |
<?php else: ?> |
| 67 |
<option <?php selected( $landing_page['id'], $meta['landing_page'] ); ?> |
| 68 |
value="<?php echo esc_attr( $landing_page['id'], |
| 69 |
'convertkit' ); ?>"><?php echo esc_attr( $name ); ?></option> |
| 70 |
<?php endif; |
| 71 |
endforeach; ?> |
| 72 |
</select> |
| 73 |
<p class="description"><?php esc_html_e( 'Select a landing page to make it appear in place of this page.', |
| 74 |
'convertkit' ); ?></p> |
| 75 |
</td> |
| 76 |
</tr> |
| 77 |
<?php } ?> |
| 78 |
<?php // custom content mapping |
| 79 |
$meta_tag = isset( $meta['tag'] ) ? $meta['tag'] : ''; |
| 80 |
?> |
| 81 |
<tr valign="top"> |
| 82 |
<th scope="row"><label for=""><?php esc_html_e( 'Add a Tag', 'convertkit' ); ?></label></th> |
| 83 |
<td> |
| 84 |
<select name="wp-convertkit[tag]" id="wp-convertkit-tag"> |
| 85 |
<option <?php selected( '', $meta_tag ); ?> value="0"><?php _e( 'None', |
| 86 |
'convertkit' ); // WPCS: XSS ok. ?></option> |
| 87 |
<?php |
| 88 |
foreach ( $tags as $tag ) { |
| 89 |
$name = sanitize_text_field( $tag['name'] ); |
| 90 |
?> |
| 91 |
<option <?php selected( $tag['id'], $meta_tag ); ?>value="<?php echo esc_attr( $tag['id'], |
| 92 |
'convertkit' ); ?>"><?php echo esc_attr( $name ); ?></option> |
| 93 |
<?php } ?> |
| 94 |
</select> |
| 95 |
<p class="description"><?php esc_html_e( 'Select a tag to apply to viewers of this page.', |
| 96 |
'convertkit' ); ?></p> |
| 97 |
</td> |
| 98 |
</tr> |
| 99 |
<?php endif; ?> |
| 100 |
</tbody> |
| 101 |
</table> |
| 102 |
|
| 103 |
<?php wp_nonce_field( 'wp-convertkit-save-meta', 'wp-convertkit-save-meta-nonce' ); |
| 104 |
|