field-bulk-edit.php
9 months ago
field-meta-box-news.php
9 months ago
field-meta-box.php
7 months ago
field-news-categories.php
9 months ago
field-news-hierarchical.php
7 months ago
field-news-keywords.php
7 months ago
field-news-name.php
10 months ago
field-news-notifier.php
6 months ago
field-news-post-type.php
9 months ago
field-news-stocktickers.php
7 months ago
field-quick-edit.php
1 year ago
field-robots.php
1 year ago
field-sitemap-author-settings.php
7 months ago
field-sitemap-authors.php
9 months ago
field-sitemap-custom.php
1 year ago
field-sitemap-disable.php
1 year ago
field-sitemap-notifier.php
3 months ago
field-sitemap-post-type-settings.php
3 months ago
field-sitemap-post-types-limit.php
1 year ago
field-sitemap-post-types.php
9 months ago
field-sitemap-server.php
7 months ago
field-sitemap-slug.php
9 months ago
field-sitemap-taxonomies.php
9 months ago
field-sitemap-taxonomy-settings.php
7 months ago
field-sitemap-urls.php
1 year ago
field-sitemaps.php
1 year ago
help-tab-advanced.php
7 months ago
help-tab-authors.php
7 months ago
help-tab-news-categories.php
1 year ago
help-tab-news-hierarchical.php
9 months ago
help-tab-news-keywords.php
1 year ago
help-tab-news-name.php
1 year ago
help-tab-news-notifier.php
7 months ago
help-tab-news-post-types.php
1 year ago
help-tab-news-sidebar.php
1 year ago
help-tab-news-stocktickers.php
1 year ago
help-tab-news.php
1 year ago
help-tab-post-types-general.php
1 year ago
help-tab-post-types.php
7 months ago
help-tab-robots.php
1 year ago
help-tab-sidebar.php
1 year ago
help-tab-sitemaps.php
1 year ago
help-tab-support.php
7 months ago
help-tab-taxonomies.php
7 months ago
notice-xmlsf-advanced-news.php
1 year ago
notice-xmlsf-advanced.php
1 year ago
page-sitemap-news.php
7 months ago
page-sitemap.php
9 months ago
section-advanced-compat-message.php
10 months ago
section-advanced-intro.php
1 year ago
section-advanced-news-compat-message.php
10 months ago
section-bwt-data.php
3 months ago
section-bwt-oauth-intro.php
7 months ago
section-bwt-oauth-stage-1.php
7 months ago
section-bwt-oauth-stage-2.php
7 months ago
section-gsc-data-news.php
4 months ago
section-gsc-data.php
3 months ago
section-gsc-oauth-intro.php
7 months ago
section-gsc-oauth-stage-1-2.php
3 months ago
section-gsc-oauth-stage-3.php
7 months ago
section-ping-log.php
4 months ago
sidebar-advanced-plug.php
3 months ago
sidebar-bwt-connect.php
7 months ago
sidebar-contribute.php
10 months ago
sidebar-gsc-connect.php
7 months ago
sidebar-help.php
7 months ago
sidebar-links.php
7 months ago
sidebar-news-advanced-plug.php
7 months ago
sidebar-news-links.php
7 months ago
sidebar-news-tools.php
9 months ago
sidebar-priority-support.php
9 months ago
sidebar-tools.php
9 months ago
field-news-post-type.php
67 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Post types fields |
| 4 | * |
| 5 | * @package XML Sitemap & Google News |
| 6 | */ |
| 7 | |
| 8 | global $wp_taxonomies; |
| 9 | |
| 10 | $post_types = apply_filters( |
| 11 | 'xmlsf_news_post_types', |
| 12 | get_post_types( |
| 13 | array( |
| 14 | 'public' => true, |
| 15 | 'hierarchical' => false, |
| 16 | ) |
| 17 | /*,'objects'*/ |
| 18 | ) |
| 19 | ); |
| 20 | |
| 21 | // Make sure post types are allowed and publicly viewable. |
| 22 | $post_types = array_diff( $post_types, xmlsf()->disabled_post_types() ); |
| 23 | $post_types = array_filter( $post_types, 'is_post_type_viewable' ); |
| 24 | |
| 25 | if ( ! is_array( $post_types ) || empty( $post_types ) ) { |
| 26 | // This should never happen. |
| 27 | echo '<p class="description warning">' . esc_html__( 'There appear to be no post types available.', 'xml-sitemap-feed' ) . '</p>'; |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | $options = (array) \get_option( 'xmlsf_news_tags', array() ); |
| 32 | $news_post_type = isset( $options['post_type'] ) && ! empty( $options['post_type'] ) ? (array) $options['post_type'] : array( 'post' ); |
| 33 | $field_type = apply_filters( 'xmlsf_news_post_type_field_type', 1 === count( $news_post_type ) ? 'radio' : 'checkbox' ); |
| 34 | $allowed = ( ! empty( $options['categories'] ) && isset( $wp_taxonomies['category'] ) ) ? $wp_taxonomies['category']->object_type : $post_types; |
| 35 | $do_warning = ( ! empty( $options['categories'] ) && count( $post_types ) > 1 ) ? true : false; |
| 36 | |
| 37 | ?> |
| 38 | <fieldset> |
| 39 | <legend class="screen-reader-text"><?php esc_html_e( 'Post types', 'xml-sitemap-feed' ); ?></legend> |
| 40 | <?php |
| 41 | foreach ( $post_types as $_post_type ) : |
| 42 | $obj = get_post_type_object( $_post_type ); |
| 43 | if ( ! is_object( $obj ) ) { |
| 44 | continue; |
| 45 | } |
| 46 | ?> |
| 47 | <label> |
| 48 | <input type="<?php echo esc_attr( $field_type ); ?>" name="xmlsf_news_tags[post_type][]" id="xmlsf_post_type_<?php echo esc_attr( $obj->name ); ?>" value="<?php echo esc_attr( $obj->name ); ?>"<?php checked( in_array( $obj->name, $news_post_type, true ), true ) . disabled( ! in_array( $obj->name, $allowed, true ), true ); ?> /> |
| 49 | <?php echo esc_html( $obj->label ); ?> |
| 50 | </label> |
| 51 | <br/> |
| 52 | <?php endforeach; if ( $do_warning || 'radio' === $field_type ) : ?> |
| 53 | <p class="description"> |
| 54 | <?php |
| 55 | if ( $do_warning ) { |
| 56 | esc_html_e( 'Custom post types that do not use the post category taxonomy, cannot be included as long as any category is selected below.', 'xml-sitemap-feed' ); |
| 57 | } |
| 58 | ?> |
| 59 | <?php |
| 60 | if ( 'radio' === $field_type ) { |
| 61 | printf( /* Translators: Advanced plugin name */ esc_html__( 'Including multiple post types in the same News Sitemap is provided by the %s module.', 'xml-sitemap-feed' ), '<a href="https://premium.status301.com/downloads/google-news-advanced/" target="_blank">' . esc_html__( 'Google News Advanced', 'xml-sitemap-feed' ) . '</a>' ); |
| 62 | } |
| 63 | ?> |
| 64 | </p> |
| 65 | <?php endif; ?> |
| 66 | </fieldset> |
| 67 |