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 custom Theme Functions here | |
| remove_action( 'woocommerce_after_main_content', 'flatsome_pages_in_search_results', 10 ); | |
| // Add Pages and blog posts to top of search results if set. | |
| function relevanssi_pages_in_search_results() { | |
| if ( ! is_search() || ! get_theme_mod( 'search_result', 1 ) ) { | |
| return; | |
| } |
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, then go save the problem post and let me know what this prints out. | |
| add_filter( 'relevanssi_post_content_before_tokenize', 'rlv_test_content' ); | |
| function rlv_test_content( $content ) { | |
| var_dump( $content ); | |
| exit(); | |
| } |
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_results', 'rlv_exact_boost' ); | |
| function rlv_exact_boost( $results ) { | |
| $query = strtolower( get_search_query() ); | |
| foreach ( $results as $post_id => $weight ) { | |
| $custom_fields = get_post_meta( $post_id ); | |
| foreach ( $custom_fields as $field => $values ) { | |
| if ( in_array( $field, array( 'custom_field_1', 'custom_field_2', 'custom_field_3' ), true ) ) { | |
| $values = implode( ' ', $values ); |
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 | |
| /** | |
| * /lib/search.php | |
| * | |
| * @package Relevanssi | |
| * @author Mikko Saari | |
| * @license https://wordpress.org/about/gpl/ GNU General Public License | |
| * @see https://www.relevanssi.com/ | |
| */ |
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 function to your theme functions.php and reindex. | |
| add_filter( 'relevanssi_content_to_index', 'rlv_index_attachment_names', 10, 2 ); | |
| function rlv_index_attachment_names( $content, $post_id ) { | |
| $attachments = get_children( | |
| array( | |
| 'post_parent' => $post_id, | |
| 'post_type' => 'attachment', | |
| ) |
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 yor theme functions.php | |
| function bento_post_content() { | |
| global $post; | |
| // If project post type and has a sidebar, exit | |
| if ( get_post_type() == 'project' && get_post_meta( $post->ID, 'bento_sidebar_layout', true ) != 'full-width' ) { | |
| return; | |
| } |
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
| [ | |
| [ | |
| { | |
| "url":"https:\/\/www.example.ca\/", | |
| "title":"Canadian page", | |
| "lang":"en_ca" | |
| }, | |
| { | |
| "url":"http:\/\/www.example.com\/", | |
| "title":"US page", |
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 the theme functions.php | |
| add_filter( 'relevanssi_post_content', 'rlv_div_remove' ); | |
| function rlv_div_remove( $content ) { | |
| $content = preg_replace( '/<div.*/s', '', $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 | |
| // Replace the relevanssi_default_post_ok() function in the file lib/common.php with this: | |
| /** | |
| * Checks whether the user is allowed to see the post. | |
| * | |
| * The default behaviour on 'relevanssi_post_ok' filter hook. Do note that while | |
| * this function takes $post_ok as a parameter, it actually doesn't care much | |
| * about the previous value, and will instead overwrite it. If you want to make | |
| * sure your value is preserved, either disable this default function, or run |