| 1 |
<?php |
| 2 |
// If this file is called directly, abort. |
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Post Types selection for Google Instant Indexing auto-submit. |
| 9 |
* |
| 10 |
* Expects: |
| 11 |
* $post_types_settings - array, currently selected post type slugs |
| 12 |
* |
| 13 |
* @package Google Instant Indexing |
| 14 |
*/ |
| 15 |
?> |
| 16 |
<div class="dashboard-card" style="padding: 20px;"> |
| 17 |
<h2 style="margin-top: 0;">Post Types Configuration</h2> |
| 18 |
<p style="color: var(--dashboard-text-secondary); margin-bottom: 20px;">Select which post types should be automatically submitted to Google on publish.</p> |
| 19 |
|
| 20 |
<table class="form-table" style="margin-top: 0;"> |
| 21 |
<tr> |
| 22 |
<th scope="row" style="width: 200px;"> |
| 23 |
Post Types: |
| 24 |
</th> |
| 25 |
<td> |
| 26 |
<?php |
| 27 |
$all_post_types = get_post_types(['public' => true], 'objects'); |
| 28 |
$excluded_types = ['attachment', 'elementor_library', 'e-floating-buttons', 'e-landing-page', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'wp_block', 'wp_template', 'wp_template_part', 'wp_navigation', 'wp_font_family', 'wp_font_face']; |
| 29 |
foreach ($all_post_types as $pt) { |
| 30 |
if (in_array($pt->name, $excluded_types, true)) { |
| 31 |
continue; |
| 32 |
} |
| 33 |
?> |
| 34 |
<label class="pr"><input type="checkbox" name="metasync_post_types[<?php echo esc_attr($pt->name); ?>]" value="<?php echo esc_attr($pt->name); ?>" <?php checked(in_array($pt->name, $post_types_settings, true)); ?>> <?php echo esc_html($pt->label); ?></label> |
| 35 |
<?php |
| 36 |
} |
| 37 |
?> |
| 38 |
</td> |
| 39 |
</tr> |
| 40 |
</table> |
| 41 |
</div> |
| 42 |
|