WordPress Short Code – Displays Post and Product Suggestions

From many handful option Relevant Related Posts plugin provides standard for WordPress option – short code. We usually recommend other modern options to embed the widget into the articles and pages, like Gutenberg block, WordPress widget or Elementor widget. However we also provide old fashion short code for the people who finds it more convenient. Shot code provides absolutely the same functionality as other available widget options. So, lets describe the functionality and parameters briefly.

[rel_posts keyword="plugin" num="post=3&product=3" align="left" exclude="617" width="50%" order="random"][/rel_posts]

Here is a working example of the short code above:

Related Posts Short Code Parameters

keyword – search keyword or keywords that will help to generate the suggestions for the widget.

num – defined the number of certain types that had to be included into the suggestions. This parameter has URL parameters notation. For example:

num="post=3&product=3"

exclude – comma separated list of post IDs that should not be included into suggestions. Posts can be of any enabled type.

include – comma separated list of post IDs that should be included into suggestions. Posts can be of any enabled type.

width – width of the block. Any of the css formats.

style – suggestion widget layout style. Possible values are:

  • thumb-row – row layout with thumbnails
  • thumb-column – column layout with thumbs
  • txt-row – row layout text only
  • txt-column – column layout text only

align – suggestion block alignment. Possible values are left, center, right.

order – order of the suggestions in a suggestion block. Possible values are:

  • default – default order, suggestions as is
  • random – random order of generated suggestions
  • alpha_asc – alphabetical ascending order
  • alpha_desc – alphabetical descending order
  • date_asc – ascending order by publish date
  • date_desc – descending order by publish date

show_date – post suggestions will display post publish date.

more – this option allows to display “More” button that will redirect visitor to the search page with the appropriate search parameters.

Post and Product Suggestions and WordPress Search Engines – Relevanssi, SearchWP, ElasticPress and Default Search Engine

Relevant Related Posts WordPress plugin works quite well with default WordPress search. It implements quite good caching and should not slow down the website. However more powerful search plugins like Relevanssi, SearchWP, ElasticPress will work better. You should also take into consideration that specialized search plugins are often more configurable, flexible and has much faster indexes. So, we highly recommend to use our plugin with one of the specialized search engines/plugins.

WordPress Short Code – Displays Post and Product Suggestions