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_filter( 'relevanssi_where', 'rlv_polylang_tax_term' ); | |
| function rlv_polylang_tax_term( $where ) { | |
| $current_language = pll_current_language(); | |
| $languages = get_terms( array( 'taxonomy' => 'language' ) ); | |
| $language_id = 0; | |
| foreach ( $languages as $language ) { | |
| if ( $language->slug === $current_language ) { | |
| $language_id = $language->term_id; |
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 | |
| /** | |
| * Adds accented variations to letters. | |
| * | |
| * In order to have non-accented letters in search terms match the accented terms in | |
| * full text, this function adds accent variations to the search terms. | |
| * | |
| * @param string $word The word to manipulate. | |
| * |
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 | |
| $begin_time = microtime( true ); | |
| $material = <<<EOF | |
| N1 E1 F3 W3 J4 | |
| S1 E1 O1 I1 H3 | |
| B2 V3 Y3 T1 N1 | |
| G2 R1 O1 T1 D2 | |
| U1 A1 D2 L1 M2 |
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 | |
| // Lisää nämä teeman functions.php-tiedostoon. | |
| add_filter('relevanssi_modify_wp_query', 'rlv_liitteet'); | |
| function rlv_liitteet($query) { | |
| if (!isset($query->query_vars['post_types'])) { | |
| $query->set("post_types", array("post,page,news")); | |
| } | |
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` ( | |
| `doc` bigint(20) NOT NULL DEFAULT '0', | |
| `term` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '0', | |
| `term_reverse` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '0', | |
| `content` mediumint(9) NOT NULL DEFAULT '0', | |
| `title` mediumint(9) NOT NULL DEFAULT '0', | |
| `comment` mediumint(9) NOT NULL DEFAULT '0', | |
| `tag` mediumint(9) NOT NULL DEFAULT '0', | |
| `link` mediumint(9) NOT NULL DEFAULT '0', | |
| `author` mediumint(9) NOT NULL DEFAULT '0', |
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 rebuild the index. */ | |
| add_filter('relevanssi_remove_punctuation', 'rlv_remove_trademark', 9); | |
| function rlv_remove_trademark($a) { | |
| $a = str_replace('®', '', $a); | |
| return $a; | |
| } | |
| ?> |
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 all three functions to theme functions.php, then call rlv_customfield_dropdown() on your search results template | |
| add_filter('relevanssi_hits_filter', 'rlv_gather_categories', 99); | |
| function rlv_gather_categories($hits) { | |
| global $rlv_categories_present; | |
| $rlv_categories_present = array(); | |
| $posts = array(); | |
| $today = date("Y-m-d"); |
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_filter('relevanssi_fuzzy_query', 'rlv_loose_fuzzy'); | |
| function rlv_loose_fuzzy($fuzzy) { | |
| return "(term LIKE '%#term#%')"; | |
| } | |
| ?> |
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 | |
| // Version 1 | |
| // Add this to theme functions.php. | |
| add_filter('relevanssi_post_ok', 'rlv_simple_membership', 10, 2); | |
| function rlv_simple_membership($post_ok, $post_id) { | |
| $access_ctrl = SwpmAccessControl::get_instance(); | |
| $post_ok = $access_ctrl->can_i_read_post($post_id); | |
| return $post_ok; |
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 replace XXX with the parent page ID. | |
| add_filter('relevanssi_do_not_index', 'rlv_page_control', 10, 2); | |
| function rlv_page_control($block, $post_id) { | |
| $parent = get_post_parent_id($post_id); | |
| if ($parent != XXX) $block = true; | |
| return $block; | |
| } |