Every WordPress developer and site admin knows the value of a shortcode. Many plugins and themes use them to add specific functions and dynamics to web pages. We had some shortcodes in our free version, but with spreading the functionality of WP ULike Pro Plugin, we designed much more useful shortcodes for our paid version. in this article, we will discuss what are these shortcodes and teach you how to use them properly.
What Are Shortcodes?
Shortcodes in WordPress are little bits of code that allow you to do various things with little effort. They were introduced in WordPress 2.5, and the reason to introduce them was to allow people to execute code inside WordPress posts, pages, and widgets without writing any code directly. This allows you to embed files or create objects that would normally require a lot of code in just one single line. For example, a shortcode for embedding a video might look like this:
[video]
They can also come with attributes. For example, the built-in WordPress video shortcode can take an src attribute:
[video src="video-source.mp4"]
WordPress comes with several that are built-in. These include an audio, caption, embed, gallery, and video. Others can be added by plugins using the Shortcode API.
How to Insert Shortcodes in WordPress Plugin such as WP ULike?
Actually, this is the easiest part. just copy the shortcode from the source and paste it in your WordPress page editor, that’s it. but before that, you should know what that mini code does and how it affects your page. Many of them are self-explanatory, but they usually come with a GitHub page to guide you throw the code and its functions.
How to Edit Shortcode in WP ULike?
There is 2 shortcode available for our free users, meanwhile, we added a WP ULike ShortCode Generator Pop-up to the paid version.
Display Like Button
In order to insert voting button inside a content use the following shortcode:
[wp_ulike]
Parameters ( attributes ):
- for (string) : select item type. (Available Values:
post
,comment
,activity
,topic
) - id (integer) : select specific item ID. (For manual usage)
- button_type (string) : Set Button Type. (Available Values:
image
,text
) - style (string) : Choose the default template from the available list.
- wrapper_class (string) : Extra Wrapper class.
Display Counter Value
You can use this shortcode to display the number of likes for each content type:
[wp_ulike_counter]
Parameters ( attributes ):
- type (string) : Select item type. (Available Values:
post
,comment
,activity
,topic
) - id (integer) : Select specific item ID. (For manual usage)
- past_time (integer) : Show number of likes for certain period based on hour.
- status (string) : Distinguishes which data status to be shown in the results. (Available Values:
like
,dislike
,unlike
,undislike
)
Display Likers List
To manually display the Likers list with Custom options outside the CTA button, you can use the following shortcode:
[wp_ulike_likers_box]
Parameters ( attributes ):
- type (string) : Select item type. (Available Values:
post
,comment
,activity
,topic
) - id (integer) : Select specific item ID. (For manual usage)
- counter (integer) : Item show at most.
- avatar_size (integer) : Pixel value for Avatar size.
- template (string): This attribute contains an HTML structure similar to the one placed in the settings panel. for example:
<div class="wp-ulike-likers-list">
%START_WHILE%
<span class="wp-ulike-liker">
<a href="#" title="%USER_NAME%">%USER_AVATAR%</a>
</span>
%END_WHILE%
</div>
* Allowed Variables: %USER_AVATAR%
, %BP_PROFILE_URL%
, %UM_PROFILE_URL%
, %USER_NAME%
, %START_WHILE%
, %END_WHILE%
See? that was easy. These shortcodes are available in your free version. but let’s talk like a pro.
WP ULike Pro Shortcode Guide
We added a unique WP ULike Shortcode Button to WordPress Editor page which makes things very easy. you just click on attributes you want in the pop-up window and it generates the shortcode. This shortcode generator is only available in the paid version of the plugin.
User Info Display
[wp_ulike_pro_user_info type="data_counter"]
It’s the default code, which can show any user’s activity in post, comments, activity, and topic such as like, dislike, unlike, and undislike.
The other types are Last Activity and Last Status, which shows what their name suggests respectively. in every 3 types of using this ShortCode, you can add before and after the text to these outputs in the respective fields and also a specific message if the requested value is empty.
Parameters ( attributes ):
- user_id (integer): Select specific user ID. (For manual usage)
- type (string) : Determines which type of data from the user will be shown. (Available Values:
data_counter
,last_activity
,last_status
) - table (string) : Select item type table. (Available Values:
post
,comment
,activity
,topic
) - status (string) : Distinguishes which data status to be shown in the results. (Available Values:
like
,dislike
,unlike
,undislike
) - before_text (string) : Custom prefix text to display before value.
- after_text (string) : Custom postfix text to display after value.
- empty_text (string) : Display custom message if value is empty.
Get Items List
You can use this shortcode to display a complete list of a user’s latest activities:
[wp_ulike_pro_items type="post" rel_type="post" status="like"]
For example, this code displays the latest articles liked by the user.
Parameters ( attributes ):
- type (string) : Select item type table. (Available Values:
post
,comment
,activity
,topic
) - rel_type(string) : Use this option to select post types. (When type attribute equals to post)
- user_id (integer) : Select specific user ID. (For manual usage)
- anonymize_user(boolean) : Enable this option to display the items for not logged in users.
- status (string) : Distinguishes which data status to be shown in the results. (Available Values:
like
,dislike
,unlike
,undislike
) - is_popular (boolean): Enable items to be sorted by the number of likes.
- limit (integer) : Item show at most.
- empty_text (string) : Display custom message if query is empty.
User Profile
If you need to show a User Profile on a page, this code will do it by calling the user ID and returns the user profile as a result.
[wp_ulike_pro_completeness_profile user_id="56"]
Parameters ( attributes ):
- user_id (integer) : it determines which user info to show in the result.
- force_current_user (boolean) : Changes the current user based on profile ID.
Login Form
To display AJAX login forms, you can use the following shortcode:
[wp_ulike_pro_login_form form_id="1"]
Parameters ( attributes ):
- form_id (integer) : Custom form id.
- username (string) : Username label.
- password (string) : Password label.
- remember (string) : Remember me label.
- button (string) : Submit button label.
- reset_password (string) : Forgot password label.
- reset_url (string) : Custom URL for reset password page.
- signup_message (string) : Don’t have and account label.
- signup_text (string) : Create account label.
- redirect_to (string) : Custom redirect URL after success. ( You can also user ‘current_page’ value for current page redirect )
- ajax_toggle (boolean) : Use it to switch between forms using AJAX requests.
Signup Form
To display AJAX register forms, you can use the following shortcode:
[wp_ulike_pro_signup_form form_id="1"]
Parameters ( attributes ):
- form_id (integer) : Custom form id.
- username (string) : Username label.
- firstname (string) : First name label.
- lastname (string) : Last name label.
- password (string) : Password label.
- email (string) : Email label.
- button (string) : Submit button label.
- login_message (string) : Already have an account label.
- login_text (string) : Sign in label.
- redirect_to (string) : Custom redirect URL after success. ( You can also user ‘current_page’ value for current page redirect )
- ajax_toggle (boolean) : Use it to switch between forms using AJAX requests.
Reset Password Form
To display AJAX reset password forms, you can use the following shortcode:
[wp_ulike_pro_reset_password_form form_id="1"]
Parameters ( attributes ):
- form_id (integer) : Custom form id.
- reset_message (string) : Reset your password message.
- change_message (string) : Enter your new password message.
- mail_message (string) : Check your email message.
- username (string) : Username or email label.
- new_pass (string) : New password label.
- re_new_pass (string) : Re-enter new password label.
- invalidkey (string) : Invalid key message.
- expiredkey (string) : Expired key message
- reset_button (string) : Get new password button label.
- change_button (string) : Reset password button label.
- login_message (string) : Go to login page label.
- ajax_toggle (boolean) : Use it to switch between forms using AJAX requests.
Edit Account Form
To display edit account forms, you can use the following shortcode:
[wp_ulike_pro_account_form form_id="1"]
Parameters ( attributes ):
- form_id (integer) : Custom form id.
- firstname (string) : First name label.
- lastname (string) : Last name label.
- website (string) : Website label.
- description (string) : Biographical info label.
- email (string) : Email label.
- avatar (string) : Upload avatar label.
- button (string) : Submit button label.
- permission_message (string) : You don’t have access message.
Share Buttons
You can use this shortcode to display the share buttons:
[wp_ulike_pro_social_share slug="single_test"]
Parameters ( attributes ):
- slug (string) : Slug name from items.
- data-url (string) : Redefines document.location.href
- data-title (string) : Redefines document.title
- data-description (string) : Redefines meta[name=”description”]
- data-image (string) : Redefines link[rel=”apple-touch-icon”]
2-Factor Authentication
After you enabled the 2-Step authentication, you’ll need to complete a second step to verify it’s you when you sign in. That’s why you need a simple form and QR code to add your verification accounts.
For this purpose, put the following shortcode in our profile builder tabs or any other page you want.
[wp_ulike_pro_two_factor_setup]
Parameters ( attributes ):
- title (string) : Setup 2-factor Authentication title.
- description (string) : the description info below the title.
- accounts_title (string) : Usable authentication accounts title.
- app_name (string) : Authenticator app title.
- ago_text (string) : A custom string for “ago” which appears after human readable time format.
- button (string) : Submit button text.
- limit_accounts (integer) : the limit of requesting authentication acccounts. (default: 5)
- qrcode_size (integer) : QR Code image size. (default: 256)
- limit_message (string) : A message when user reached the limit for requesting authentication acccounts.
- permission_message (string) : Access denied message.
How to edit WP ULike shortcode in Elementor?
There is an Elementor Widget named Shortcode, you can easily copy and paste your shortcode in this widget and use them on any page you want or need.
13 Responses
Hi,
I am thinking to buy a plugin but have few queries:
1. I want to use multiple buttons on the page I used the shortcode in the product loop but when I click the button it add +1 like to all buttons in loop on page
2) I need user can like only if the user is logged in.
Hi Jan,
1- For this purpose you need to use custom ID for each shortcode. e.g.
2- Sure, this feature is available in plugin settings panel.
Hello
1) I have a dress collection and I want the user can like what dresses she likes. Is there any panel available for my user to see all her liked dresses? (without creating an account)
2) Is the plugin compatible with AVADA theme?
Hi Lennart,
1- Yes, if you make a premium version, you can use this shortcode on a page like profile builder:
User Not Found!
-
-
-
-
-
-
-
-
-
2- Yes, we’re compatible with all standard themes.
Hi,
I tried your free version to add a like button in the portfolio items of a website and it works. I would like to use this plugin to let subscribers track which portfolio items they have already viewed (each portfolio contains a video). I would like that the like icon appears next to the post title in search results, so that subscribers can see which video they have already viewed. Can you help me achieve this result? thank you!
Hi Alissa,
This can not be done by the plugin by default, because each theme has its own structure.
But you can use the shortcode of the plugin manually in the theme functions and put the Like button in any desired query. e.g.
echo do_shortcode('
');
How to arrange comments according to the number of likes on the front-end page?
Hi,
Due to the difference in the structure of the themes, it is not possible to do this automatically by the plugin and you have to create a custom code for it.
For example, you can use the pre_get_comments hook and add ulike filters.
Hi,
Are the number of likes stored in a custom field in order to be used by another plugin that use custom fields in sort method ?
Thank you.
Best regards
Jean
Hi Jean,
Yes, you can enable & migrate standard post meta option inside pro version and use that everywhere you need.
can u please explain brief i too get the same error
Hi,
Please give us more details about your error!
Thank you for creating a great plug-in. I want to be able to press the like button only 3 times out of all posts. Is it possible?