This file contains hidden or 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 | |
| // In theme functions.php, add this: | |
| add_filter('relevanssi_hits_filter', 'rlv_gather_categories', 99); | |
| function rlv_gather_categories($hits) { | |
| global $rlv_categories_present; | |
| $rlv_categories_present = array(); | |
| foreach ( $hits[0] as $hit ) { | |
| $terms = get_the_terms( $hit->ID, 'category' ); |
This file contains hidden or 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 | |
| // Replace the relevanssi_create_excerpt() function in lib/excerpts-highlights.php with this: | |
| function relevanssi_create_excerpt($content, $terms, $query) { | |
| // If you need to modify these on the go, use 'pre_option_relevanssi_excerpt_length' filter. | |
| $excerpt_length = get_option("relevanssi_excerpt_length"); | |
| $type = get_option("relevanssi_excerpt_type"); | |
| $best_excerpt_term_hits = -1; |
This file contains hidden or 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_action('wp_ajax_relevanssi_search', 'rlv_ajax_search'); | |
| add_action('wp_ajax_nopriv_relevanssi_search', 'rlv_ajax_search'); | |
| function rlv_ajax_search() { | |
| $query = new WP_Query(); | |
| $query->set('s', $_POST['s']); | |
| /* Any other parameters you want to set, for example: | |
| $query->set('post_types', 'page'); | |
| $query->set('numberposts', 100); |
This file contains hidden or 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 | |
| // Replace the relevanssi_default_post_ok() function in lib/common.php with this to add support for Simple Membership | |
| function relevanssi_default_post_ok($post_ok, $doc) { | |
| $status = relevanssi_get_post_status($doc); | |
| // if it's not public, don't show | |
| if ('publish' != $status) { | |
| $post_ok = false; |
This file contains hidden or 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
| CREATE TABLE `wp_relevanssi_log` ( | |
| `id` bigint(9) NOT NULL AUTO_INCREMENT, | |
| `query` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL, | |
| `hits` mediumint(9) NOT NULL DEFAULT '0', | |
| `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| `user_id` bigint(20) NOT NULL DEFAULT '0', | |
| `ip` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | |
| UNIQUE KEY `id` (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
This file contains hidden or 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 | |
| /* Simple German stemmer | |
| A simple suffix stripper that can be used to stem German texts. | |
| */ | |
| add_filter( 'relevanssi_stemmer', 'relevanssi_simple_german_stemmer' ); | |
| function relevanssi_simple_german_stemmer( $term ) { | |
| $term = str_replace( 'ß', 'ss', $term ); | |
| $len = strlen( $term ); | |
| $s_endings = array( 'b', 'd', 'f', 'g', 'h', 'k', 'l', 'm', 'n', 'r', 't' ); |
This file contains hidden or 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 this to theme functions.php | |
| add_filter('relevanssi_modify_wp_query', 'rlv_modify_query'); | |
| function rlv_modify_query($query) { | |
| for ($i = 0; $i < count($query->tax_query->queries); $i++) { | |
| if (isset($query->tax_query->queries[$i])) { | |
| $row = $query->tax_query->queries[$i]; | |
| if (isset($row['taxonomy']) && $row['taxonomy'] == "product_cat") { |
This file contains hidden or 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 this to theme functions.php | |
| add_filter('relevanssi_pre_excerpt_content', 'rlv_remove_faq'); | |
| function rlv_remove_faq($content) { | |
| $content = preg_replace('/\[ultimate-faqs.*?\]/', '', $content); | |
| return $content; | |
| } |
This file contains hidden or 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 this to theme functions.php | |
| add_filter('relevanssi_post_ok', 'rlv_groups_post_ok', 10, 2); | |
| function rlv_groups_post_ok($post_ok, $doc) { | |
| $user = wp_get_current_user(); | |
| $access = Groups_Post_Access::user_can_read_post($doc, $user->ID); | |
| return $access; | |
| } |
This file contains hidden or 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 this to theme functions.php and adjust the field name (and copy the lines as many times as | |
| // necessary to include all the fields you want). | |
| add_filter('relevanssi_tax_term_additional_content', 'rlv_index_term_fields', 10, 2); | |
| function rlv_index_term_fields($content, $term) { | |
| $field = get_field('taxonomyslug_' . $term->term_id, 'field_name'); | |
| $content .= " " . $field; | |
| return $content; |