This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: ElasticPress - Custom Query Boosting | |
* Description: Add Boosting query to ElasticPress | |
* Version: 1.0.0 | |
* Author: 10up | Felipe Elia | |
* Author URI: https://10up.com/ | |
* Text Domain: elasticpress-custom-query-boosting | |
* Domain Path: /languages | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: ClassifAI and Polylang | |
* Description: Compatibility layer between the ClassifAI plugin and Polylang | |
* Version: 1.0.0 | |
* Author: Felipe Elia | |
* Author URI: https://felipeelia.dev/ | |
* Text Domain: felipeelia-classifai | |
* Domain Path: /languages | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let autosuggestTotal = 0; | |
const autosuggestDataFilter = (data) => { | |
autosuggestTotal = data?.hits?.total || 0; | |
return data; | |
} | |
wp.hooks.addFilter('ep.Autosuggest.data', 'myTheme/autosuggestDataFilter', autosuggestDataFilter); | |
const autosuggestListHTMLFilter = (listHTML, options, input) => { | |
const allUrl = new URL(input.form.action); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sync and search for Media (attachment) posts in WordPress. | |
* It is NOT to be used with the ElasticPress's Documents feature | |
*/ | |
/** | |
* Add the attachment post type to be indexable and searchable | |
* | |
* @param array $post_types Post types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
// Hit ctrl+P and select Snippets: Configure User Snippets | |
// New Global Snippets file | |
// Add `global-snippets` as the name and copy this file contents in it | |
// Go to the commit box, start typing `git_co_authored_by`, hit ctrl+space and select this snippet | |
"Git Co-authored-by": { | |
"prefix": "git_co_authored_by", | |
"body": [ | |
"", | |
"", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Since ElasticPress 4.0, thumbnails are indexed in a separate field. | |
*/ | |
add_filter( | |
'ep_post_formatted_args', | |
function ( $formatted_args ) { | |
if ( empty( $_GET['has_image'] ) ) { | |
return $formatted_args; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is a set of functions that can be used to debug | |
* the dynamic sync made by ElasticPress | |
* | |
* phpcs:disable WordPress.PHP.DevelopmentFunctions -- Reason: the whole purpose of the file is to use error_log(). | |
* | |
* @package ElasticPress_Custom | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add the ngram analyzer if not added yet by autosuggest. | |
* | |
* @param array $mapping The mapping array. | |
* @return array | |
*/ | |
function ep_custom_add_edge_ngram_analyzer( $mapping ) { | |
if ( ! @isset( $mapping['settings']['analysis']['analyzer']['edge_ngram_analyzer'] ) ) { | |
$mapping['settings']['analysis']['analyzer']['edge_ngram_analyzer'] = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add compatibility between ElasticPress and WooCommerce Customer/Order/Coupon Export. | |
*/ | |
add_filter( | |
'ep_sync_taxonomies', | |
function ( $taxonomies ) { | |
if ( class_exists( '\SkyVerge\WooCommerce\CSV_Export\Taxonomies_Handler' ) ) { | |
$taxonomies[] = \SkyVerge\WooCommerce\CSV_Export\Taxonomies_Handler::TAXONOMY_NAME_ORDERS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Part of this comment in the ElasticPress repository | |
* | |
* @see https://github.com/10up/ElasticPress/issues/2073#issuecomment-776155310 | |
*/ | |
add_filter( 'epwr_boost_mode', function() { return 'multiply'; } ); | |
add_filter( 'epwr_offset', function() { return '15d'; } ); | |
add_filter( 'epwr_scale', function() { return '30d'; } ); | |
add_filter( 'epwr_decay', function() { return 0.5; } ); |
NewerOlder