1. Go to this page and download the library: Download soderlind/wp-loupe library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Customize the schema for 'book' post type
add_filter( 'wp_loupe_schema_book', function( $schema ) {
$schema['book_isbn'] = [ // Add a new field
'weight' => 2.0, // Higher weight means higher relevance in search results
'filterable' => true, // Allow filtering by this field
'sortable' => [ // Allow sorting by this field
'direction' => 'asc' // Default sort direction
],
];
// Modify existing field settings
$schema['post_title']['weight'] = 3.0; // Increase title weight for books
// Remove a field
unset( $schema['post_excerpt'] );
$schema['book_author'] = [
'weight' => 1.5,
'filterable' => true,
'sortable' => [ 'direction' => 'asc' ],
];
return $schema;
});