dog = hound to the synonym list and enable this feature, every time the indexer sees hound in post content or post title, it will index it as hound dog. Thus, the post will be found when searching with either word. This makes it possible to use synonyms with AND searches, but will slow down indexing, especially with large databases and large lists of synonyms. You can use multi-word values, but phrases do not work.', 'relevanssi' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
?>
attachment' ); ?>
attachment' ); ?>
attachment' ); ?>
>
name, relevanssi_get_forbidden_taxonomies(), true ) ) {
continue;
}
if ( in_array( $taxonomy->name, $index_these_taxonomies, true ) ) {
$checked = 'checked';
} else {
$checked = '';
}
if ( $taxonomy->public ) {
$public = __( 'yes', 'relevanssi' );
} else {
$public = __( 'no', 'relevanssi' );
}
// Translators: %s is the post type name.
$screen_reader_label = sprintf( __( 'Index terms for taxonomy %s', 'relevanssi' ), $taxonomy->name );
$public = __( 'no', 'relevanssi' );
// Translators: %s is the post type name.
$screen_reader_public = sprintf( __( 'Taxonomy %s is not public', 'relevanssi' ), $taxonomy->name );
if ( $taxonomy->public ) {
$public = __( 'yes', 'relevanssi' );
// Translators: %s is the post type name.
$screen_reader_public = sprintf( __( 'Taxonomy %s is public', 'relevanssi' ), $taxonomy->name );
}
?>
' . esc_html__( "Couldn't reset the option, reload the page to try again.", 'relevanssi' ) . '
';
}
}
$words = get_option( 'relevanssi_words', false );
if ( ! $words ) {
$word_text = sprintf(
// Translators: %1$s is relevanssi_words.
esc_html__( 'The %1$s option doesn\'t exist. You can\'t reset it; it should be regenerated when you search for something.', 'relevanssi' ),
'relevanssi_words'
);
} elseif ( isset( $words['words'] ) && isset( $words['expire'] ) ) {
$word_count = count( $words['words'] );
$word_text = sprintf(
// Translators: %1$s is relevanssi_words, %2$d is the number of words in the option, %3$s is the expiration date of the option.
esc_html__( 'The %1$s option has %2$d words in it and the cache expires on %3$s.', 'relevanssi' ),
'relevanssi_words',
$word_count,
date_i18n( get_option( 'date_format' ), $words['expire'] )
);
} else {
$word_text = sprintf(
// Translators: %1$s is relevanssi_words.
esc_html__( 'The %1$s option is empty.', 'relevanssi' ),
'relevanssi_words'
);
}
?>
relevanssi_words.
esc_html__(
'If you are having problems with the Did you mean? feature, you can reset the %1$s option that keeps a cache. Next time the Did you mean? suggestions are needed the option is regenerated.',
'relevanssi'
),
'relevanssi_words'
);
?>
' . $message; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Generates a message giving the reason for API key and license problems.
*
* @return string The message.
*/
function relevanssi_get_api_key_notification() {
global $relevanssi_variables;
$api_key = get_network_option( null, 'relevanssi_api_key' );
if ( ! $api_key ) {
$api_key = get_option( 'relevanssi_api_key' );
}
if ( ! $api_key ) {
$url = add_query_arg(
'page',
'relevanssi-premium%2Frelevanssi.php',
get_admin_url() . 'options-general.php'
);
if ( is_plugin_active_for_network( plugin_basename( $relevanssi_variables['file'] ) ) ) {
$url = network_admin_url( 'admin.php?page=relevanssi-premium%2Frelevanssi.php' );
}
$message = sprintf(
// Translators: %1$s opens the link to the Relevanssi Premium settings page, %3$s opens the link to the Relevanssi Premium license purchase page. %2$s closes the links.
esc_html__( "The API key is not set. Please enter your API key in the %1\$sthe Relevanssi settings%2\$s. If you don't have one, %3\$syou can buy a new license here%2\$s.", 'relevanssi' ),
'',
'',
''
);
} else {
$message = sprintf(
// Translators: %1$s opens the link to the Relevanssi Premium license purchase page. %2$s closes the link.
esc_html__( "Your API key is set, but it looks like you don't have a valid license. %1\$sYou can buy a new license here%2\$s.", 'relevanssi' ),
'',
''
);
}
return $message;
}
/**
* Adds the Relevanssi columns to the post list.
*
* @param array $columns The columns.
* @param string $post_type The post type.
*/
function relevanssi_manage_columns( $columns, $post_type = 'page' ) {
$post_types = get_option( 'relevanssi_index_post_types', array() );
if ( ! in_array( $post_type, $post_types, true ) ) {
return $columns;
}
$columns['pinned_keywords'] = __( 'Pinned keywords', 'relevanssi' );
$columns['unpinned_keywords'] = __( 'Excluded keywords', 'relevanssi' );
$columns['pin_for_all'] = __( 'Pin for all searches', 'relevanssi' );
$columns['exclude_post'] = __( 'Exclude post', 'relevanssi' );
$columns['ignore_content'] = __( 'Ignore post content', 'relevanssi' );
return $columns;
}
/**
* Adds the Relevanssi Premium columns to the post list.
*
* @param array $column The column name.
* @param int $post_id The post ID.
*/
function relevanssi_manage_custom_column( $column, $post_id ) {
switch ( $column ) {
case 'pinned_keywords':
$keywords = get_post_meta( $post_id, '_relevanssi_pin_keywords', true );
if ( ! empty( $keywords ) ) {
echo esc_html( $keywords );
}
break;
case 'unpinned_keywords':
$keywords = get_post_meta( $post_id, '_relevanssi_unpin_keywords', true );
if ( ! empty( $keywords ) ) {
echo esc_html( $keywords );
}
break;
case 'pin_for_all':
$pin_for_all = get_post_meta( $post_id, '_relevanssi_pin_for_all', true );
if ( ! empty( $pin_for_all ) ) {
echo '✓';
} else {
echo '✗';
}
break;
case 'exclude_post':
$hide_post = get_post_meta( $post_id, '_relevanssi_hide_post', true );
if ( ! empty( $hide_post ) ) {
echo '✓';
} else {
echo '✗';
}
break;
case 'ignore_content':
$hide_content = get_post_meta( $post_id, '_relevanssi_hide_content', true );
if ( ! empty( $hide_content ) ) {
echo '✓';
} else {
echo '✗';
}
break;
}
}
/**
* Adds the Relevanssi custom fields to the quick edit box.
*
* @param string $column The column name.
*/
function relevanssi_quick_edit_custom_box( $column ) {
switch ( $column ) {
case 'pinned_keywords':
?>