| 1 |
<?php |
| 2 |
/** |
| 3 |
* Metabox view |
| 4 |
* |
| 5 |
* @package ConvertKit |
| 6 |
* @author ConvertKit |
| 7 |
*/ |
| 8 |
|
| 9 |
?> |
| 10 |
<table class="form-table"> |
| 11 |
<tbody> |
| 12 |
<!-- Form --> |
| 13 |
<tr valign="top"> |
| 14 |
<th scope="row"> |
| 15 |
<label for="wp-convertkit-form"><?php esc_html_e( 'Form', 'convertkit' ); ?></label> |
| 16 |
</th> |
| 17 |
<td> |
| 18 |
<div class="convertkit-select2-container"> |
| 19 |
<select name="wp-convertkit[form]" id="wp-convertkit-form" class="convertkit-select2"> |
| 20 |
<option value="-1"<?php selected( - 1, $convertkit_post->get_form() ); ?> data-preserve-on-refresh="1"> |
| 21 |
<?php esc_html_e( 'Default', 'convertkit' ); ?> |
| 22 |
</option> |
| 23 |
<option value="0"<?php selected( 0, $convertkit_post->get_form() ); ?> data-preserve-on-refresh="1"> |
| 24 |
<?php esc_html_e( 'None', 'convertkit' ); ?> |
| 25 |
</option> |
| 26 |
<?php |
| 27 |
if ( $convertkit_forms->exist() ) { |
| 28 |
foreach ( $convertkit_forms->get() as $form ) { |
| 29 |
?> |
| 30 |
<option value="<?php echo esc_attr( $form['id'] ); ?>"<?php selected( $form['id'], $convertkit_post->get_form() ); ?>> |
| 31 |
<?php echo esc_attr( $form['name'] ); ?> |
| 32 |
</option> |
| 33 |
<?php |
| 34 |
} |
| 35 |
} |
| 36 |
?> |
| 37 |
</select> |
| 38 |
<button class="wp-convertkit-refresh-resources" class="button button-secondary hide-if-no-js" title="<?php esc_attr_e( 'Refresh Forms from ConvertKit account', 'convertkit' ); ?>" data-resource="forms" data-field="#wp-convertkit-form"> |
| 39 |
<span class="dashicons dashicons-update"></span> |
| 40 |
</button> |
| 41 |
<p class="description"> |
| 42 |
<?php |
| 43 |
printf( |
| 44 |
/* translators: settings url */ |
| 45 |
__( '<code>Default</code>: Uses the form specified on the <a href="%s" target="_blank">settings page</a>.', 'convertkit' ), /* phpcs:ignore */ |
| 46 |
esc_attr( esc_url( $settings_link ) ) |
| 47 |
); |
| 48 |
?> |
| 49 |
<br /> |
| 50 |
<?php _e( '<code>None</code>: do not display a form.', 'convertkit' ); /* phpcs:ignore */ ?> |
| 51 |
<br /> |
| 52 |
<?php esc_html_e( 'Any other option will display that form after the main content.', 'convertkit' ); ?> |
| 53 |
</p> |
| 54 |
</div> |
| 55 |
|
| 56 |
<p class="description"> |
| 57 |
<?php |
| 58 |
echo sprintf( |
| 59 |
/* translators: Link to sign in to ConvertKit */ |
| 60 |
esc_html__( 'To make changes to your forms, %s', 'convertkit' ), |
| 61 |
'<a href="' . esc_url( convertkit_get_sign_in_url() ) . '" target="_blank">' . esc_html__( 'sign in to ConvertKit', 'convertkit' ) . '</a>' |
| 62 |
); |
| 63 |
?> |
| 64 |
</p> |
| 65 |
</td> |
| 66 |
</tr> |
| 67 |
|
| 68 |
<!-- Landing Page --> |
| 69 |
<?php |
| 70 |
if ( 'page' === $post->post_type ) { |
| 71 |
?> |
| 72 |
<tr valign="top"> |
| 73 |
<th scope="row"> |
| 74 |
<label for="wp-convertkit-landing_page"><?php esc_html_e( 'Landing Page', 'convertkit' ); ?></label> |
| 75 |
</th> |
| 76 |
<td> |
| 77 |
<div class="convertkit-select2-container"> |
| 78 |
<select name="wp-convertkit[landing_page]" id="wp-convertkit-landing_page" class="convertkit-select2"> |
| 79 |
<option <?php selected( '', $convertkit_post->get_landing_page() ); ?> value="0" data-preserve-on-refresh="1"> |
| 80 |
<?php esc_html_e( 'None', 'convertkit' ); ?> |
| 81 |
</option> |
| 82 |
<?php |
| 83 |
if ( $convertkit_landing_pages->exist() ) { |
| 84 |
foreach ( $convertkit_landing_pages->get() as $landing_page ) { |
| 85 |
if ( isset( $convertkit_landing_page['url'] ) ) { |
| 86 |
?> |
| 87 |
<option value="<?php echo esc_attr( $landing_page['url'] ); ?>"<?php selected( $landing_page['url'], $convertkit_post->get_landing_page() ); ?>> |
| 88 |
<?php echo esc_attr( $landing_page['name'] ); ?> |
| 89 |
</option> |
| 90 |
<?php |
| 91 |
} else { |
| 92 |
?> |
| 93 |
<option value="<?php echo esc_attr( $landing_page['id'] ); ?>"<?php selected( $landing_page['id'], $convertkit_post->get_landing_page() ); ?>> |
| 94 |
<?php echo esc_attr( $landing_page['name'] ); ?> |
| 95 |
</option> |
| 96 |
<?php |
| 97 |
} |
| 98 |
} |
| 99 |
} |
| 100 |
?> |
| 101 |
</select> |
| 102 |
<button class="wp-convertkit-refresh-resources" class="button button-secondary hide-if-no-js" title="<?php esc_attr_e( 'Refresh Landing Pages from ConvertKit account', 'convertkit' ); ?>" data-resource="landing_pages" data-field="#wp-convertkit-landing_page"> |
| 103 |
<span class="dashicons dashicons-update"></span> |
| 104 |
</button> |
| 105 |
<p class="description"> |
| 106 |
<?php esc_html_e( 'Select a landing page to make it appear in place of this page.', 'convertkit' ); ?> |
| 107 |
</p> |
| 108 |
</div> |
| 109 |
|
| 110 |
<p class="description"> |
| 111 |
<?php |
| 112 |
echo sprintf( |
| 113 |
/* translators: Link to sign in to ConvertKit */ |
| 114 |
esc_html__( 'To make changes to your landing pages, %s', 'convertkit' ), |
| 115 |
'<a href="' . esc_url( convertkit_get_sign_in_url() ) . '" target="_blank">' . esc_html__( 'sign in to ConvertKit', 'convertkit' ) . '</a>' |
| 116 |
); |
| 117 |
?> |
| 118 |
</p> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
<?php |
| 122 |
} |
| 123 |
?> |
| 124 |
|
| 125 |
<!-- Tag --> |
| 126 |
<tr valign="top"> |
| 127 |
<th scope="row"> |
| 128 |
<label for="wp-convertkit-tag"><?php esc_html_e( 'Add a Tag', 'convertkit' ); ?></label> |
| 129 |
</th> |
| 130 |
<td> |
| 131 |
<div class="convertkit-select2-container"> |
| 132 |
<select name="wp-convertkit[tag]" id="wp-convertkit-tag" class="convertkit-select2"> |
| 133 |
<option value="0"<?php selected( '', $convertkit_post->get_tag() ); ?> data-preserve-on-refresh="1"> |
| 134 |
<?php esc_html_e( 'None', 'convertkit' ); ?> |
| 135 |
</option> |
| 136 |
<?php |
| 137 |
if ( $convertkit_tags->exist() ) { |
| 138 |
foreach ( $convertkit_tags->get() as $convertkit_tag ) { |
| 139 |
?> |
| 140 |
<option value="<?php echo esc_attr( $convertkit_tag['id'] ); ?>"<?php selected( $convertkit_tag['id'], $convertkit_post->get_tag() ); ?>> |
| 141 |
<?php echo esc_attr( $convertkit_tag['name'] ); ?> |
| 142 |
</option> |
| 143 |
<?php |
| 144 |
} |
| 145 |
} |
| 146 |
?> |
| 147 |
</select> |
| 148 |
<button class="wp-convertkit-refresh-resources" class="button button-secondary hide-if-no-js" title="<?php esc_attr_e( 'Refresh Tags from ConvertKit account', 'convertkit' ); ?>" data-resource="tags" data-field="#wp-convertkit-tag"> |
| 149 |
<span class="dashicons dashicons-update"></span> |
| 150 |
</button> |
| 151 |
<p class="description"> |
| 152 |
<?php esc_html_e( 'Select a tag to apply to visitors of this page who are subscribed.', 'convertkit' ); ?> |
| 153 |
<br /> |
| 154 |
<?php esc_html_e( 'A visitor is deemed to be subscribed if they have clicked a link in an email to this site which includes their subscriber ID, or have entered their email address in a ConvertKit Form on this site.', 'convertkit' ); ?> |
| 155 |
</p> |
| 156 |
</div> |
| 157 |
</td> |
| 158 |
</tr> |
| 159 |
</tbody> |
| 160 |
</table> |
| 161 |
|
| 162 |
<?php |
| 163 |
wp_nonce_field( 'wp-convertkit-save-meta', 'wp-convertkit-save-meta-nonce' ); |
| 164 |
|