Skip to content

Getting Started with WP ULike Shortcodes

WP ULike Shortcode

Getting Started with WP ULike Shortcodes

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.

wp ulike shortcode generator

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: postcommentactivitytopic)
  • id (integer) : select specific item ID. (For manual usage)
  • button_type (string) : Set Button Type. (Available Values: imagetext)
  • 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: postcommentactivitytopic)
  • id (integer) : Select specific item ID. (For manual usage)
  • 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: postcommentactivitytopic)
  • 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_counterlast_activitylast_status)
  • table (string) : Select item type table. (Available Values: postcommentactivitytopic)
  • 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: postcommentactivitytopic)
  • user_id (integer) : Select specific user ID. (For manual usage)
  • status (string) : Distinguishes which data status to be shown in the results. (Available Values: like, dislike, unlike, undislike)
  • 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.

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.

was this article helpful?
7
2
Share on facebook
Share on linkedin
Share on twitter
Share on telegram
Related Posts
Comments

No comment yet, add your voice below!


Add a Comment

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

Want to create ultimate user profiles?