I Recommend This Plugin

Shortcodes

The “I Recommend This” plugin provides two shortcodes to help you display recommendation buttons and top recommended posts or pages on your WordPress site.

1. [irecommendthis]

This shortcode displays the recommendation button for a post or page.

Usage

[irecommendthis]

Attributes

  • id (optional): The ID of the post or page. If not specified, it defaults to the current post or page.

Example

To display the recommendation button for a post with ID 123:

[irecommendthis id="123"]

2. [irecommendthis_top_posts]

This shortcode displays the top recommended posts or pages.

Usage

[irecommendthis_top_posts container="div" number="5" post_type="post" year="2024" monthnum="6" show_count="1"]

Attributes

  • container (optional): The HTML container element for each post/page. Defaults to li.
  • number (optional): The number of posts/pages to display. Defaults to 10.
  • post_type (optional): The type of content to display (post or page). Defaults to post.
  • year (optional): Filter posts/pages by a specific year. Defaults to an empty string (no filtering by year).
  • monthnum (optional): Filter posts/pages by a specific month (1-12). Defaults to an empty string (no filtering by month).
  • show_count (optional): Display the recommendation count. Set to 1 to show the count and 0 to hide it. Defaults to 1.

Examples

To display the top 5 recommended posts in a div container for the year 2024 and the month of June:

[irecommendthis_top_posts container="div" number="5" post_type="post" year="2024" monthnum="6" show_count="1"]

To display the top 10 recommended pages without filtering by year or month:

[irecommendthis_top_posts post_type="page"]

To display the top 3 recommended posts without the recommendation count:

[irecommendthis_top_posts number="3" show_count="0"]

Using these shortcodes, you can easily add recommendation buttons and display top recommended content on your WordPress site. Customize the attributes as needed to fit your specific use case.

Was this article helpful? ·