'0' ) );
$pt_2 = get_post_types( array( 'exclude_from_search' => false ) );
$public_types = array_merge( $pt_1, $pt_2 );
$post_types = get_post_types();
foreach ( $post_types as $type ) {
if ( in_array( $type, relevanssi_get_forbidden_post_types(), true ) ) {
continue;
}
$checked = '';
if ( in_array( $type, $index_post_types, true ) ) {
$checked = 'checked="checked"';
}
// Translators: %s is the post type name.
$screen_reader_label = sprintf( __( 'Index post type %s', 'relevanssi' ), $type );
$label = $type;
$excluded_from_search = __( 'yes', 'relevanssi' );
// Translators: %s is the post type name.
$screen_reader_exclude = sprintf( __( 'Post type %s is excluded from search', 'relevanssi' ), $type );
if ( in_array( $type, $public_types, true ) ) {
$excluded_from_search = __( 'no', 'relevanssi' );
// Translators: %s is the post type name.
$screen_reader_exclude = sprintf( __( 'Post type %s can be searched', 'relevanssi' ), $type );
}
$name_id = 'relevanssi_index_type_' . $type;
printf(
'
%1$s %2$s
%5$s %6$s
',
esc_html( $screen_reader_label ),
esc_html( $label ),
esc_attr( $name_id ),
esc_html( $checked ),
esc_html( $excluded_from_search ),
esc_html( $screen_reader_exclude )
);
}
?>
Helper control field to make sure settings are saved if no post types are selected.
This is our little secret, just for you and me
name, relevanssi_get_forbidden_taxonomies(), true ) ) {
continue;
}
$checked = '';
if ( in_array( $taxonomy->name, $index_taxonomies_list, true ) ) {
$checked = 'checked="checked"';
}
// Translators: %s is the taxonomy name.
$screen_reader_label = sprintf( __( 'Index taxonomy %s', 'relevanssi' ), $taxonomy->name );
$public = __( 'no', 'relevanssi' );
// Translators: %s is the taxonomy name.
$screen_reader_public = sprintf( __( 'Taxonomy %s is not public', 'relevanssi' ), $taxonomy->name );
if ( $taxonomy->public ) {
$public = __( 'yes', 'relevanssi' );
// Translators: %s is the taxonomy name.
$screen_reader_public = sprintf( __( 'Taxonomy %s is public', 'relevanssi' ), $taxonomy->name );
}
$name_id = 'relevanssi_index_taxonomy_' . $taxonomy->name;
printf(
'
%1$s %2$s
%5$s %6$s
',
esc_html( $screen_reader_label ),
esc_html( $taxonomy->name ),
esc_attr( $name_id ),
esc_html( $checked ),
esc_html( $public ),
esc_html( $screen_reader_public )
);
}
?>