| @@ -16,8 +16,21 @@ | ||
| 16 | 16 | ?> |
| 17 | 17 | |
| 18 | 18 | <div class="metasync-opengraph-meta-box"> |
| 19 | 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 | + | |
| 20 | 33 | <!-- Toggle Switch --> |
| 21 | 34 | <div class="metasync-og-toggle-section"> |
| 22 | 35 | <label class="metasync-toggle-switch"> |
| 23 | 36 | <input type="checkbox" |
| @@ -40,15 +53,15 @@ | ||
| 40 | 53 | <h4><?php esc_html_e('Open Graph Tags', 'metasync'); ?></h4> |
| 41 | 54 | |
| 42 | 55 | <div class="metasync-og-field-group"> |
| 43 | 56 | <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); ?>" | |
| 57 | + <input type="text" | |
| 58 | + id="metasync_og_title" | |
| 59 | + name="_metasync_og_title" | |
| 60 | + value="<?php echo esc_attr($og_title); ?>" | |
| 48 | 61 | class="widefat metasync-og-input" |
| 49 | 62 | maxlength="60" |
| 50 | - placeholder="<?php echo esc_attr($post->post_title); ?>"> | |
| 63 | + placeholder="<?php echo esc_attr($title_placeholder); ?>"> | |
| 51 | 64 | <p class="description"> |
| 52 | 65 | <?php esc_html_e('The title that will appear when shared on social media. Recommended: 60 characters or less.', 'metasync'); ?> |
| 53 | 66 | <span class="metasync-char-count" data-target="metasync_og_title">0/60</span> |
| 54 | 67 | </p> |
| @@ -60,9 +73,9 @@ | ||
| 60 | 73 | name="_metasync_og_description" |
| 61 | 74 | class="widefat metasync-og-input" |
| 62 | 75 | rows="3" |
| 63 | 76 | maxlength="155" |
| 64 | - placeholder="<?php echo esc_attr($this->get_post_excerpt($post)); ?>"><?php echo esc_textarea($og_description); ?></textarea> | |
| 77 | + placeholder="<?php echo esc_attr($description_placeholder); ?>"><?php echo esc_textarea($og_description); ?></textarea> | |
| 65 | 78 | <p class="description"> |
| 66 | 79 | <?php esc_html_e('The description that will appear when shared on social media. Recommended: 155 characters or less.', 'metasync'); ?> |
| 67 | 80 | <span class="metasync-char-count" data-target="metasync_og_description">0/155</span> |
| 68 | 81 | </p> |
| @@ -164,15 +177,15 @@ | ||
| 164 | 177 | </div> |
| 165 | 178 | |
| 166 | 179 | <div class="metasync-og-field-group"> |
| 167 | 180 | <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); ?>" | |
| 181 | + <input type="text" | |
| 182 | + id="metasync_twitter_title" | |
| 183 | + name="_metasync_twitter_title" | |
| 184 | + value="<?php echo esc_attr($twitter_title); ?>" | |
| 172 | 185 | class="widefat metasync-og-input" |
| 173 | 186 | maxlength="70" |
| 174 | - placeholder="<?php echo esc_attr($og_title); ?>"> | |
| 187 | + placeholder="<?php echo esc_attr($twitter_title_placeholder); ?>"> | |
| 175 | 188 | <p class="description"> |
| 176 | 189 | <?php esc_html_e('Twitter-specific title. Leave empty to use the Open Graph title. Max: 70 characters.', 'metasync'); ?> |
| 177 | 190 | <span class="metasync-char-count" data-target="metasync_twitter_title">0/70</span> |
| 178 | 191 | </p> |
| @@ -184,9 +197,9 @@ | ||
| 184 | 197 | name="_metasync_twitter_description" |
| 185 | 198 | class="widefat metasync-og-input" |
| 186 | 199 | rows="2" |
| 187 | 200 | maxlength="200" |
| 188 | - placeholder="<?php echo esc_attr($og_description); ?>"><?php echo esc_textarea($twitter_description); ?></textarea> | |
| 201 | + placeholder="<?php echo esc_attr($twitter_description_placeholder); ?>"><?php echo esc_textarea($twitter_description); ?></textarea> | |
| 189 | 202 | <p class="description"> |
| 190 | 203 | <?php esc_html_e('Twitter-specific description. Leave empty to use the Open Graph description. Max: 200 characters.', 'metasync'); ?> |
| 191 | 204 | <span class="metasync-char-count" data-target="metasync_twitter_description">0/200</span> |
| 192 | 205 | </p> |
| @@ -418,11 +431,14 @@ | ||
| 418 | 431 | </div> |
| 419 | 432 | |
| 420 | 433 | <div class="metasync-preview-content-wrapper"> |
| 421 | 434 | <?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); | |
| 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; | |
| 425 | 441 | $initial_image = !empty($og_image) ? $og_image : $this->get_featured_image_url($post->ID); |
| 426 | 442 | $initial_url = !empty($og_url) ? $og_url : get_permalink($post->ID); |
| 427 | 443 | $initial_twitter_title = !empty($twitter_title) ? $twitter_title : ''; |
| 428 | 444 | $initial_twitter_description = !empty($twitter_description) ? $twitter_description : ''; |