Continue reading Related Posts

Related Posts

…in the template: // First display a set of posts with the default settings. relevanssi_the_related_posts( $post->ID ); global $doing_second_related_posts; $doing_second_related_posts = true; // Get the post objects with the new settings. relevanssi_the_related_posts( $post->ID ); // This can be in theme functions.php: // Add a filter to adjust the settings on……to use random posts or leave the related posts empty. Adding the related posts manually If you don’t want to append the related posts to the posts automatically, you can use the relevanssi_the_related_posts() function in your templates. The function will print out the related posts. If used without a parameter,……around the caching, you need to use different methods for each set: you can display one with the standard relevanssi_the_related_posts() function and the other with relevanssi_get_related_post_objects() which will create a separate cache. Here’s one example of how to display two sets of related posts in a post template: // First…

Read more Related Posts 0 Comment on Related Posts
Continue reading Index custom field contents

Index custom field contents

…to set up custom fields By default, Relevanssi doesn’t index any custom fields. That is easy to change. Just go to the Relevanssi settings page, navigate to the Indexing tab and find this setting: Custom field settings Here you can see the possible settings. You can choose to index all……it covers all custom fields that are visible in the user interface, on the post edit page. WordPress hides all the custom fields that have names that start with underscores from the post edit pages: that’s where the theme settings are generally hidden. If there are just a few specific……matching the search query is only in custom fields and not in post content, Relevanssi won’t be able to use it in excerpts. That is fortunately easy to fix. Just go to Relevanssi settings and the Excerpts and Highlights tab, and enable the “Use custom fields for excerpts” option. Use…

Read more Index custom field contents 50 Comments on Index custom field contents
Continue reading Indexing and searching PDFs in WordPress

Indexing and searching PDFs in WordPress

…service on a separate server. Which PDF files can you index? Since Relevanssi is a WordPress search, Relevanssi operates on WordPress posts (including all the different post types). So, to have Relevanssi index your PDFs, they need to be WordPress posts. That’s fortunately really simple: upload your PDF files to……the Media library, and they become posts with the post type of attachment. Relevanssi can only parse and read PDF files that contain text. If the PDF file is all images, Relevanssi cannot read it. An easy way to check is to try to select the text in a PDFRelevanssi Premium users have asked for PDF indexing since day one, and version 2.0 finally introduced this feature. Coming up with a fast and reliable method hasn’t been easy, but we’re pretty proud of what we have now. Our PDF indexer doesn’t tax your server as it runs as a…

Read more Indexing and searching PDFs in WordPress 78 Comments on Indexing and searching PDFs in WordPress
Continue reading Taxonomy archive search

Taxonomy archive search

This is a Premium feature and only applies when you index taxonomy terms. This does not apply in free Relevanssi. To include taxonomy pages (categories, tags, custom taxonomies) in the search, enable the option on the options page. There’s also the option to choose which taxonomies are included. By default……the post object created from the taxonomy page, $post->post_title contains the name of the taxonomy, $post->post_content has the description, $post->link has the permalink and $post->post_type will contain the name of the taxonomy. If you want to modify the post objects Relevanssi creates from the taxonomies, you can use the relevanssi_taxonomy_term_to_post filter….…empty terms (not linked to any posts) are excluded from the index. If you want to modify that, see relevanssi_hide_empty_terms. What is indexed? Currently, the title of the taxonomy is indexed with the description field. Indexing the other fields isn’t currently possible. Taxonomy pages should be automatically updated in the…

Read more Taxonomy archive search 49 Comments on Taxonomy archive search
Continue reading Multisite searches

Multisite searches

Multisite search only works in Relevanssi Premium. Free Relevanssi can be installed in multisite environments, but it cannot search across sites. Relevanssi Premium can only support multisite searching across sites in the same multisite network. Relevanssi can’t search across multiple sites that are not in the same multisite installation. Cloud-based……other hand, you can adjust the settings for each blog. Enabling the multisite search There are several ways to enable multisite searching. If you want all searches to be multisite searches, you can enable multisite searching from the Relevanssi searching settings. If you want only some searches to be multisite…to what multisite searching can do. There’s limited access to search parameters. You can use post_type, operator, meta_query, include_attachments and orderby. Taxonomy terms from subsites can cause problems. Searching for taxonomy terms in taxonomies that exist in the current site works: for example searching for categories from different sites works,…

Read more Multisite searches 144 Comments on Multisite searches
Continue reading Direct access to the query engine

Direct access to the query engine

Relevanssi can’t be used in any situation, because it checks the presence of search with the is_search() function. This causes some unfortunate limitations and reduces the general usability of the plugin. You can, however, access the query engine directly. There’s a function called relevanssi_do_query(), which can be used to do search queries…

Read more Direct access to the query engine 61 Comments on Direct access to the query engine