PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.6.13
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.6.13
2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 2.6.4 2.6.3 All 139 releases
metasync / admin / partials / metasync-opengraph-meta-box.php

metasync-opengraph-meta-box.php in Search Atlas SEO – OTTO AI SEO Automation for WordPress 2.6.13, at admin/partials/metasync-opengraph-meta-box.php

442 lines 25.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Meta box template for Open Graph settings
5 *
6 * @package MetaSync
7 * @subpackage MetaSync/admin/partials
8 * @since 1.0.0
9 */
10
11 // Prevent direct access
12 if (!defined('ABSPATH')) {
13 exit;
14 }
15
16 ?>
17
18 <div class="metasync-opengraph-meta-box">
19
20 <!-- Toggle Switch -->
21 <div class="metasync-og-toggle-section">
22 <label class="metasync-toggle-switch">
23 <input type="checkbox"
24 name="_metasync_og_enabled"
25 value="1"
26 <?php checked($og_enabled, '1'); ?>
27 class="metasync-og-toggle">
28 <span class="metasync-toggle-slider"></span>
29 <span class="metasync-toggle-label"><?php esc_html_e('Enable Open Graph & Social Media Tags', 'metasync'); ?></span>
30 </label>
31 <p class="description">
32 <?php esc_html_e('Enable this to add Open Graph and Twitter Card meta tags to this post/page for better social media sharing.', 'metasync'); ?>
33 </p>
34 </div>
35
36 <div class="metasync-og-content" <?php echo ($og_enabled !== '1') ? 'style="display:none;"' : ''; ?>>
37
38 <!-- Open Graph Section -->
39 <div class="metasync-og-section">
40 <h4><?php esc_html_e('Open Graph Tags', 'metasync'); ?></h4>
41
42 <div class="metasync-og-field-group">
43 <label for="metasync_og_title"><?php esc_html_e('Title (og:title)', 'metasync'); ?></label>
44 <input type="text"
45 id="metasync_og_title"
46 name="_metasync_og_title"
47 value="<?php echo esc_attr($og_title); ?>"
48 class="widefat metasync-og-input"
49 maxlength="60"
50 placeholder="<?php echo esc_attr($post->post_title); ?>">
51 <p class="description">
52 <?php esc_html_e('The title that will appear when shared on social media. Recommended: 60 characters or less.', 'metasync'); ?>
53 <span class="metasync-char-count" data-target="metasync_og_title">0/60</span>
54 </p>
55 </div>
56
57 <div class="metasync-og-field-group">
58 <label for="metasync_og_description"><?php esc_html_e('Description (og:description)', 'metasync'); ?></label>
59 <textarea id="metasync_og_description"
60 name="_metasync_og_description"
61 class="widefat metasync-og-input"
62 rows="3"
63 maxlength="155"
64 placeholder="<?php echo esc_attr($this->get_post_excerpt($post)); ?>"><?php echo esc_textarea($og_description); ?></textarea>
65 <p class="description">
66 <?php esc_html_e('The description that will appear when shared on social media. Recommended: 155 characters or less.', 'metasync'); ?>
67 <span class="metasync-char-count" data-target="metasync_og_description">0/155</span>
68 </p>
69 </div>
70
71 <div class="metasync-og-field-group">
72 <label for="metasync_og_image"><?php esc_html_e('Image (og:image)', 'metasync'); ?></label>
73 <div class="metasync-image-field">
74 <input type="url"
75 id="metasync_og_image"
76 name="_metasync_og_image"
77 value="<?php echo esc_attr($og_image); ?>"
78 class="widefat metasync-og-input"
79 placeholder="<?php esc_html_e('https://example.com/image.jpg', 'metasync'); ?>">
80 <div class="metasync-image-controls">
81 <button type="button" class="button metasync-upload-image">
82 <?php esc_html_e('Select Image', 'metasync'); ?>
83 </button>
84 <button type="button" class="button metasync-remove-image" style="<?php echo empty($og_image) ? 'display:none;' : ''; ?>">
85 <?php esc_html_e('Remove', 'metasync'); ?>
86 </button>
87 </div>
88 </div>
89 <div class="metasync-image-preview" <?php echo empty($og_image) ? 'style="display:none;"' : ''; ?>>
90 <img src="<?php echo esc_url($og_image); ?>" alt="<?php esc_html_e('Preview', 'metasync'); ?>">
91 </div>
92 <p class="description">
93 <?php esc_html_e('The image that will appear when shared on social media. Recommended size: 1200x630 pixels.', 'metasync'); ?>
94 </p>
95 </div>
96
97 <div class="metasync-og-field-row">
98 <div class="metasync-og-field-group metasync-half-width">
99 <label for="metasync_og_type"><?php esc_html_e('Type (og:type)', 'metasync'); ?></label>
100 <select id="metasync_og_type" name="_metasync_og_type" class="widefat">
101 <option value="article" <?php selected($og_type, 'article'); ?>><?php esc_html_e('Article', 'metasync'); ?></option>
102 <option value="website" <?php selected($og_type, 'website'); ?>><?php esc_html_e('Website', 'metasync'); ?></option>
103 <option value="blog" <?php selected($og_type, 'blog'); ?>><?php esc_html_e('Blog', 'metasync'); ?></option>
104 <option value="product" <?php selected($og_type, 'product'); ?>><?php esc_html_e('Product', 'metasync'); ?></option>
105 <option value="video" <?php selected($og_type, 'video'); ?>><?php esc_html_e('Video', 'metasync'); ?></option>
106 <option value="music" <?php selected($og_type, 'music'); ?>><?php esc_html_e('Music', 'metasync'); ?></option>
107 </select>
108 </div>
109
110 <div class="metasync-og-field-group metasync-half-width">
111 <label for="metasync_og_url"><?php esc_html_e('URL (og:url)', 'metasync'); ?></label>
112 <input type="url"
113 id="metasync_og_url"
114 name="_metasync_og_url"
115 value="<?php echo esc_attr($og_url); ?>"
116 class="widefat metasync-og-input"
117 placeholder="<?php echo esc_attr($this->get_canonical_url($post)); ?>"
118 <?php echo ($post->post_status === 'auto-draft') ? 'disabled' : ''; ?>>
119 <?php if ($post->post_status === 'auto-draft'): ?>
120 <p class="description metasync-url-disabled-notice">
121 <span class="dashicons dashicons-info"></span>
122 <?php esc_html_e('This field will be automatically populated with the post permalink after you save the post for the first time.', 'metasync'); ?>
123 </p>
124 <?php else: ?>
125 <p class="description">
126 <?php esc_html_e('The canonical URL for this post. Leave empty to use the post permalink, or enter a custom URL.', 'metasync'); ?>
127 <button type="button" class="button button-small metasync-use-permalink" style="margin-left: 10px;">
128 <?php esc_html_e('Use Post Permalink', 'metasync'); ?>
129 </button>
130 </p>
131 <?php endif; ?>
132 </div>
133 </div>
134 </div>
135
136 <!-- Twitter Card Section -->
137 <div class="metasync-twitter-section">
138 <h4><?php esc_html_e('Twitter Card Tags', 'metasync'); ?></h4>
139
140 <div class="metasync-og-field-group">
141 <label for="metasync_twitter_card"><?php esc_html_e('Card Type', 'metasync'); ?></label>
142 <select id="metasync_twitter_card" name="_metasync_twitter_card" class="widefat">
143 <option value="summary" <?php selected($twitter_card, 'summary'); ?>><?php esc_html_e('Summary', 'metasync'); ?></option>
144 <option value="summary_large_image" <?php selected($twitter_card, 'summary_large_image'); ?>><?php esc_html_e('Summary Large Image', 'metasync'); ?></option>
145 <option value="app" <?php selected($twitter_card, 'app'); ?>><?php esc_html_e('App', 'metasync'); ?></option>
146 <option value="player" <?php selected($twitter_card, 'player'); ?>><?php esc_html_e('Player', 'metasync'); ?></option>
147 </select>
148 <p class="description">
149 <?php esc_html_e('The type of Twitter Card to display. "Summary Large Image" is recommended for most content.', 'metasync'); ?>
150 </p>
151 </div>
152
153 <div class="metasync-og-field-group">
154 <label for="metasync_twitter_site"><?php esc_html_e('Twitter Site (@username)', 'metasync'); ?></label>
155 <input type="text"
156 id="metasync_twitter_site"
157 name="_metasync_twitter_site"
158 value="<?php echo esc_attr($twitter_site); ?>"
159 class="widefat"
160 placeholder="@yoursite">
161 <p class="description">
162 <?php esc_html_e('Your site\'s Twitter username (including @). This will be used for attribution.', 'metasync'); ?>
163 </p>
164 </div>
165
166 <div class="metasync-og-field-group">
167 <label for="metasync_twitter_title"><?php esc_html_e('Twitter Title', 'metasync'); ?></label>
168 <input type="text"
169 id="metasync_twitter_title"
170 name="_metasync_twitter_title"
171 value="<?php echo esc_attr($twitter_title); ?>"
172 class="widefat metasync-og-input"
173 maxlength="70"
174 placeholder="<?php echo esc_attr($og_title); ?>">
175 <p class="description">
176 <?php esc_html_e('Twitter-specific title. Leave empty to use the Open Graph title. Max: 70 characters.', 'metasync'); ?>
177 <span class="metasync-char-count" data-target="metasync_twitter_title">0/70</span>
178 </p>
179 </div>
180
181 <div class="metasync-og-field-group">
182 <label for="metasync_twitter_description"><?php esc_html_e('Twitter Description', 'metasync'); ?></label>
183 <textarea id="metasync_twitter_description"
184 name="_metasync_twitter_description"
185 class="widefat metasync-og-input"
186 rows="2"
187 maxlength="200"
188 placeholder="<?php echo esc_attr($og_description); ?>"><?php echo esc_textarea($twitter_description); ?></textarea>
189 <p class="description">
190 <?php esc_html_e('Twitter-specific description. Leave empty to use the Open Graph description. Max: 200 characters.', 'metasync'); ?>
191 <span class="metasync-char-count" data-target="metasync_twitter_description">0/200</span>
192 </p>
193 </div>
194
195 <div class="metasync-og-field-group">
196 <label for="metasync_twitter_image"><?php esc_html_e('Twitter Image', 'metasync'); ?></label>
197 <div class="metasync-image-field">
198 <input type="url"
199 id="metasync_twitter_image"
200 name="_metasync_twitter_image"
201 value="<?php echo esc_attr($twitter_image); ?>"
202 class="widefat metasync-og-input"
203 placeholder="<?php echo esc_attr($og_image); ?>">
204 <div class="metasync-image-controls">
205 <button type="button" class="button metasync-upload-twitter-image">
206 <?php esc_html_e('Select Image', 'metasync'); ?>
207 </button>
208 <button type="button" class="button metasync-remove-twitter-image" style="<?php echo empty($twitter_image) ? 'display:none;' : ''; ?>">
209 <?php esc_html_e('Remove', 'metasync'); ?>
210 </button>
211 </div>
212 </div>
213 <div class="metasync-twitter-image-preview" <?php echo empty($twitter_image) ? 'style="display:none;"' : ''; ?>>
214 <img src="<?php echo esc_url($twitter_image); ?>" alt="<?php esc_html_e('Preview', 'metasync'); ?>">
215 </div>
216 <p class="description">
217 <?php esc_html_e('Twitter-specific image. Leave empty to use the Open Graph image. Recommended: 1200x675 pixels.', 'metasync'); ?>
218 </p>
219 </div>
220
221 <div class="metasync-og-field-group">
222 <label for="metasync_twitter_image_alt"><?php esc_html_e('Twitter Image Alt Text', 'metasync'); ?></label>
223 <input type="text"
224 id="metasync_twitter_image_alt"
225 name="_metasync_twitter_image_alt"
226 value="<?php echo esc_attr($twitter_image_alt); ?>"
227 class="widefat metasync-og-input"
228 maxlength="420"
229 placeholder="<?php esc_html_e('Describe the image for visually impaired users', 'metasync'); ?>">
230 <p class="description">
231 <?php esc_html_e('Alt text for the Twitter image. Essential for accessibility. Max: 420 characters.', 'metasync'); ?>
232 <span class="metasync-char-count" data-target="metasync_twitter_image_alt">0/420</span>
233 </p>
234 </div>
235 </div>
236
237 <!-- Twitter App Card Section -->
238 <div class="metasync-twitter-app-section" style="display: none;">
239 <h4><?php esc_html_e('Twitter App Card Settings', 'metasync'); ?></h4>
240 <p class="description">
241 <?php esc_html_e('Configure settings for Twitter App Card. These fields are only used when Twitter Card type is set to "App".', 'metasync'); ?>
242 </p>
243
244 <div class="metasync-og-field-group">
245 <label for="metasync_twitter_app_id_iphone"><?php esc_html_e('iPhone App ID', 'metasync'); ?> <span class="required">*</span></label>
246 <input type="text"
247 id="metasync_twitter_app_id_iphone"
248 name="_metasync_twitter_app_id_iphone"
249 value="<?php echo esc_attr($twitter_app_id_iphone); ?>"
250 class="widefat"
251 placeholder="307234931"
252 disabled>
253 <p class="description">
254 <?php esc_html_e('Numeric representation of your app ID in the App Store (e.g., "307234931").', 'metasync'); ?>
255 </p>
256 </div>
257
258 <div class="metasync-og-field-group">
259 <label for="metasync_twitter_app_id_ipad"><?php esc_html_e('iPad App ID', 'metasync'); ?> <span class="required">*</span></label>
260 <input type="text"
261 id="metasync_twitter_app_id_ipad"
262 name="_metasync_twitter_app_id_ipad"
263 value="<?php echo esc_attr($twitter_app_id_ipad); ?>"
264 class="widefat"
265 placeholder="307234931"
266 disabled>
267 <p class="description">
268 <?php esc_html_e('Numeric representation of your app ID in the App Store (e.g., "307234931").', 'metasync'); ?>
269 </p>
270 </div>
271
272 <div class="metasync-og-field-group">
273 <label for="metasync_twitter_app_id_googleplay"><?php esc_html_e('Google Play App ID', 'metasync'); ?> <span class="required">*</span></label>
274 <input type="text"
275 id="metasync_twitter_app_id_googleplay"
276 name="_metasync_twitter_app_id_googleplay"
277 value="<?php echo esc_attr($twitter_app_id_googleplay); ?>"
278 class="widefat"
279 placeholder="com.android.app"
280 disabled>
281
282 <p class="description">
283 <?php esc_html_e('String representation of your app ID in Google Play (e.g., "com.android.app").', 'metasync'); ?>
284 </p>
285 </div>
286
287 <div class="metasync-og-field-row">
288 <div class="metasync-og-field-group metasync-half-width">
289 <label for="metasync_twitter_app_url_iphone"><?php esc_html_e('iPhone Custom URL', 'metasync'); ?></label>
290 <input type="url"
291 id="metasync_twitter_app_url_iphone"
292 name="_metasync_twitter_app_url_iphone"
293 value="<?php echo esc_attr($twitter_app_url_iphone); ?>"
294 class="widefat"
295 placeholder="myapp://"
296 disabled>
297 <p class="description">
298 <?php esc_html_e('Custom URL scheme (include "://" after scheme name).', 'metasync'); ?>
299 </p>
300 </div>
301
302 <div class="metasync-og-field-group metasync-half-width">
303 <label for="metasync_twitter_app_url_ipad"><?php esc_html_e('iPad Custom URL', 'metasync'); ?></label>
304 <input type="url"
305 id="metasync_twitter_app_url_ipad"
306 name="_metasync_twitter_app_url_ipad"
307 value="<?php echo esc_attr($twitter_app_url_ipad); ?>"
308 class="widefat"
309 placeholder="myapp://"
310 disabled>
311 <p class="description">
312 <?php esc_html_e('Custom URL scheme (include "://" after scheme name).', 'metasync'); ?>
313 </p>
314 </div>
315 </div>
316
317 <div class="metasync-og-field-row">
318 <div class="metasync-og-field-group metasync-half-width">
319 <label for="metasync_twitter_app_url_googleplay"><?php esc_html_e('Google Play Custom URL', 'metasync'); ?></label>
320 <input type="url"
321 id="metasync_twitter_app_url_googleplay"
322 name="_metasync_twitter_app_url_googleplay"
323 value="<?php echo esc_attr($twitter_app_url_googleplay); ?>"
324 class="widefat"
325 placeholder="myapp://"
326 disabled>
327 <p class="description">
328 <?php esc_html_e('Custom URL scheme (include "://" after scheme name).', 'metasync'); ?>
329 </p>
330 </div>
331
332 <div class="metasync-og-field-group metasync-half-width">
333 <label for="metasync_twitter_app_country"><?php esc_html_e('App Store Country', 'metasync'); ?></label>
334 <select id="metasync_twitter_app_country" name="_metasync_twitter_app_country" class="widefat" disabled>
335 <option value=""><?php esc_html_e('US (Default)', 'metasync'); ?></option>
336 <option value="GB" <?php selected($twitter_app_country, 'GB'); ?>><?php esc_html_e('United Kingdom', 'metasync'); ?></option>
337 <option value="CA" <?php selected($twitter_app_country, 'CA'); ?>><?php esc_html_e('Canada', 'metasync'); ?></option>
338 <option value="AU" <?php selected($twitter_app_country, 'AU'); ?>><?php esc_html_e('Australia', 'metasync'); ?></option>
339 <option value="DE" <?php selected($twitter_app_country, 'DE'); ?>><?php esc_html_e('Germany', 'metasync'); ?></option>
340 <option value="FR" <?php selected($twitter_app_country, 'FR'); ?>><?php esc_html_e('France', 'metasync'); ?></option>
341 <option value="JP" <?php selected($twitter_app_country, 'JP'); ?>><?php esc_html_e('Japan', 'metasync'); ?></option>
342 <option value="IN" <?php selected($twitter_app_country, 'IN'); ?>><?php esc_html_e('India', 'metasync'); ?></option>
343 <option value="BR" <?php selected($twitter_app_country, 'BR'); ?>><?php esc_html_e('Brazil', 'metasync'); ?></option>
344 <option value="MX" <?php selected($twitter_app_country, 'MX'); ?>><?php esc_html_e('Mexico', 'metasync'); ?></option>
345 </select>
346 <p class="description">
347 <?php esc_html_e('Required if your app is not available in the US App Store.', 'metasync'); ?>
348 </p>
349 </div>
350 </div>
351 </div>
352
353 <!-- Twitter Player Card Section -->
354 <div class="metasync-twitter-player-section" style="display: none;">
355 <h4><?php esc_html_e('Twitter Player Card Settings', 'metasync'); ?></h4>
356 <p class="description">
357 <?php esc_html_e('Configure settings for Twitter Player Card. These fields are only used when Twitter Card type is set to "Player".', 'metasync'); ?>
358 </p>
359
360 <div class="metasync-og-field-group">
361 <label for="metasync_twitter_player"><?php esc_html_e('Player URL', 'metasync'); ?> <span class="required">*</span></label>
362 <input type="url"
363 id="metasync_twitter_player"
364 name="_metasync_twitter_player"
365 value="<?php echo esc_attr($twitter_player); ?>"
366 class="widefat"
367 placeholder="https://example.com/player"
368 disabled>
369 <p class="description">
370 <?php esc_html_e('HTTPS URL to iFrame player. Must be HTTPS and not generate mixed content warnings.', 'metasync'); ?>
371 </p>
372 </div>
373
374 <div class="metasync-og-field-row">
375 <div class="metasync-og-field-group metasync-half-width">
376 <label for="metasync_twitter_player_width"><?php esc_html_e('Player Width (px)', 'metasync'); ?> <span class="required">*</span></label>
377 <input type="number"
378 id="metasync_twitter_player_width"
379 name="_metasync_twitter_player_width"
380 value="<?php echo esc_attr($twitter_player_width); ?>"
381 class="widefat"
382 min="1"
383 placeholder="1280"
384 disabled>
385 <p class="description">
386 <?php esc_html_e('Width of iFrame player in pixels.', 'metasync'); ?>
387 </p>
388 </div>
389
390 <div class="metasync-og-field-group metasync-half-width">
391 <label for="metasync_twitter_player_height"><?php esc_html_e('Player Height (px)', 'metasync'); ?> <span class="required">*</span></label>
392 <input type="number"
393 id="metasync_twitter_player_height"
394 name="_metasync_twitter_player_height"
395 value="<?php echo esc_attr($twitter_player_height); ?>"
396 class="widefat"
397 min="1"
398 placeholder="720"
399 disabled>
400 <p class="description">
401 <?php esc_html_e('Height of iFrame player in pixels.', 'metasync'); ?>
402 </p>
403 </div>
404 </div>
405 </div>
406
407 <!-- Social Media Preview -->
408 <div class="metasync-preview-section">
409 <h4><?php esc_html_e('Social Media Preview', 'metasync'); ?></h4>
410 <p class="description">
411 <?php esc_html_e('This is how your content will look when shared on social media platforms.', 'metasync'); ?>
412 </p>
413
414 <div class="metasync-preview-container">
415 <div class="metasync-preview-loading" style="display:none;">
416 <span class="spinner is-active"></span>
417 <?php esc_html_e('Generating preview...', 'metasync'); ?>
418 </div>
419
420 <div class="metasync-preview-content-wrapper">
421 <?php
422 // Show initial preview with current values
423 $initial_title = !empty($og_title) ? $og_title : $post->post_title;
424 $initial_description = !empty($og_description) ? $og_description : $this->get_post_excerpt($post);
425 $initial_image = !empty($og_image) ? $og_image : $this->get_featured_image_url($post->ID);
426 $initial_url = !empty($og_url) ? $og_url : get_permalink($post->ID);
427 $initial_twitter_title = !empty($twitter_title) ? $twitter_title : '';
428 $initial_twitter_description = !empty($twitter_description) ? $twitter_description : '';
429 $initial_twitter_image = !empty($twitter_image) ? $twitter_image : '';
430
431 echo $this->generate_preview_html($initial_title, $initial_description, $initial_image, $initial_url, $initial_twitter_title, $initial_twitter_description, $initial_twitter_image);
432 ?>
433 </div>
434 </div>
435
436 <button type="button" class="button button-secondary metasync-refresh-preview">
437 <?php esc_html_e('Refresh Preview', 'metasync'); ?>
438 </button>
439 </div>
440 </div>
441 </div>
442