PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.7.1
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.7.1
2.7.1 2.7.2 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 All 141 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.7.1, at admin/partials/metasync-opengraph-meta-box.php

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