Continue reading Indexing image captions for the posts

Indexing image captions for the posts

The use case is I run several newspapers, and the “caption” field when uploading media is where the journalists put the photographer credit. We need to be able to index the photographer bylines, but ideally would want to return the story/commentary where their image was used, not the image itself. If you want to index…

Read more Indexing image captions for the posts 0 Comment on Indexing image captions for the posts
Continue reading Yoast SEO

Yoast SEO

…If you want Relevanssi to disregard the Yoast SEO “noindex” setting, you can adjust that from the advanced indexing settings. Using Yoast SEO title instead of post title Adding this function to your site will make Relevanssi use the Yoast SEO title instead of post title when indexing posts: add_filter(…SEO title instead of post title Adding this function to your site will make Relevanssi use the Yoast SEO title instead of post title when indexing posts: add_filter( ‘relevanssi_post_title_before_tokenize’, ‘rlv_use_yoast_title’, 10, 2 ); function rlv_use_yoast_title( $title, $post ) { return get_post_meta( $post->ID, ‘_yoast_wpseo_title’, true ); } (Read more about relevanssi_post_title_before_tokenize.)…Starting from versions 2.4.0 (Premium) and 4.3.0 (Free), Relevanssi doesn’t index posts that have been marked “noindex” in the Yoast SEO settings (“Allow search engines to show this Post in search results?”). If the “noindex” setting is in the default value or set to explicit “yes”, Relevanssi indexes the post….

Read more Yoast SEO 6 Comments on Yoast SEO
Continue reading Searching Bible verses

Searching Bible verses

A surprisingly common problem with Relevanssi is Bible verses. All that meaningful punctuation and single digits make exact matching of Bible verses really difficult for Relevanssi, and when searching for Bible verses, exact results are what matters – hitting something similar is generally not very helpful. There’s an easy solution, though: use phrases. Wrapping the verse…

Read more Searching Bible verses 1 Comment on Searching Bible verses
Continue reading Events Calendar: Remove past events from search

Events Calendar: Remove past events from search

…is to do both. Blocking the events in indexing with relevanssi_indexing_restriction will keep the index lean and blocking the events in searching with relevanssi_post_ok will make sure past events will be removed immediately from the search results. These instructions apply to The Events Calendar plugin, which stores the event end……= false; } } return $status; } /** * Removes past events from indexing. * * @param array $restriction The MySQL restriction and an explanation. * * @return array The restriction set with event restriction included. */ function rlv_exclude_past_events( $restriction ) { global $wpdb; $restriction[‘mysql’] .= ” AND post.ID NOT…

Read more Events Calendar: Remove past events from search 6 Comments on Events Calendar: Remove past events from search
Continue reading Indexing embedded PDFs for the parent post

Indexing embedded PDFs for the parent post

…10 ); function rlv_algoriviever_content( $block ) { if ( $block[‘blockName’] === ‘algori-pdf-viewer/block-algori-pdf-viewer’ ) { $block[‘innerContent’] = array( get_post_meta( $block[‘attrs’][‘id’], ‘_relevanssi_pdf_content’, true ) ); } return $block; } PDF Content in Excerpts To get excerpts from the PDF content, you can use the same function with the relevanssi_excerpt_content filter hook, like……File block from WordPress, this snippet will index the PDF contents for the post where the file is embedded: add_filter( ‘relevanssi_block_to_render’, function( $block ) { if ( ‘core/file’ === $block[‘blockName’] ) { $file_id = $block[‘attrs’][‘id’]; $file_content = get_post_meta( $file_id, ‘_relevanssi_pdf_content’, true ); if ( $file_content ) { $block[‘innerContent’][0] = $file_content;……meta_key = ‘_wp_attached_file’ AND meta_value = %s )”, $pdf_url ) ); $content .= $pdf_content; } } return $content; } If you use the Gutenberg block, the code is different and uses the relevanssi_block_to_render filter hook: add_filter( ‘relevanssi_block_to_render’, ‘rlv_pdfembedder_content’, 10 ); function rlv_pdfembedder_content( $block ) { if ( $block[‘blockName’] === ‘pdfemb/pdf-embedder-viewer’…

Read more Indexing embedded PDFs for the parent post 5 Comments on Indexing embedded PDFs for the parent post
Continue reading Chamber Dashboard Business Directory

Chamber Dashboard Business Directory

The Chamber Dashboard Business Directory plugin has a business directory search that’s not compatible with Relevanssi. To disable Relevanssi in those searches, add this to your theme functions.php: add_filter( ‘relevanssi_prevent_default_request’, ‘rlv_allow_chamber_search’, 10, 2 ); function rlv_allow_chamber_search( $prevent, $query ) { if ( isset( $_GET[‘searchtext’] ) ) { $prevent = false;…

Read more Chamber Dashboard Business Directory 0 Comment on Chamber Dashboard Business Directory
Continue reading Related Posts

Related Posts

…of words (maybe closer to ten words), searching may become a bit too heavy. The heaviness is not a problem in general searches because very few users use this many search terms, but this can be a problem in Related posts searches. One way to improve performance in these cases……Relevanssi uses a simple CSS grid to lay out the related posts. This setting determines the minimum width of each element. Experiment with different values to see what works. If you want to style the related posts, Relevanssi wraps everything inside div#relevanssi_related, the header is in div.relevanssi_related_grid_header, and the grid……itself is in div#relevanssi_related_grid. Each post is a div.relevanssi_related_post. If you want to make more extensive modifications, you can create your template. Relevanssi will look for the relevanssi-related.php template inside the current theme templates directory, and if it finds one, it will use that instead of the default template. When…

Read more Related Posts 0 Comment on Related Posts
Continue reading Toolset Views

Toolset Views

Relevanssi works fine with Toolset, thanks to a lot of compatibility code the makers of Toolset have included in it to make it work with Relevanssi. However, everything doesn’t work automatically without modifications. The key thing to notice with Toolset is that query variables and filters don’t work the way you’d expect. Because of the…

Read more Toolset Views 6 Comments on Toolset Views