[Plugin: Relevanssi – A Better Search] WP e-Commerce support in Relevanssi
-
I’ve figured how to make Relevanssi play well with WP e-Commerce. Changing line 1607 in relevanssi.php from:
$content = apply_filters('the_content', $post->post_content);
To:
if ( 'wpsc-product' == relevanssi_get_post_type($post->ID) ) { $content = $post->post_content . ( !empty($post->post_excerpt) ? " $post->post_excerpt" : '' ); } else { $content = apply_filters('the_content', $post->post_content); }
Causes Relevanssi’s excerpts to take into account WP e-Commerce’s use of the post_excerpt field as a place for additional textual product information.
Alternatively, it can be made to work as a function placed somewhere else. Here I made it thus:
add_filter('relevanssi_excerpt_content','wpscproductexcerpt',10,3); function wpscproductexcerpt($content, $post, $query) { if ( 'wpsc-product' == relevanssi_get_post_type($post->ID) ) { $content = $post->post_content . ( !empty($post->post_excerpt) ? " $post->post_excerpt" : '' ); if ( 'on' == get_option('relevanssi_expand_shortcodes') ) { $content = do_shortcode($content); } else { $content = strip_shortcodes($content); } // The line below fixes a minor bug in Relevanssi 2.9.14 custom excerpt generating code: $content = preg_replace("/\t/", ' ', $content); } return $content; }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘[Plugin: Relevanssi – A Better Search] WP e-Commerce support in Relevanssi’ is closed to new replies.