Posted on

Search shortcode

Relevanssi adds a shortcode to help making links to search results. That way users can easily find more information about a given subject from your blog. The syntax is simple:

This will make the text John Doe a link to search results for John Doe. In case you want to link to some other search term than the anchor text (necessary in languages like Finnish), you can use:

Now the search will be for John Doe, but the anchor says Mr. John Doe.

One more parameter: setting  will wrap the search term in quotation marks, making it a phrase. This can be useful in some cases.

2 comments Search shortcode

  1. Is there a way to show search terms like the shortcode does but in the template?
    I want to display the 2 most popular search terms and while I cant find a way to do this automatically, if I can just show two terms in my template file that would work.

  2. There’s no automatic way to do it. Check the Relevanssi source code to see how the “User searches” page is made, you can see the MySQL code to get the most popular search terms.

Leave a Reply to James Cancel reply

Are you a Relevanssi Premium customer looking for support? Please use the Premium support form.

Your email address will not be published. Required fields are marked *