14th Nov '22
/
0 comments

Show User’s Liked Posts in Bricks with WP ULike

This Pro tutorial shows how posts liked by the currently logged in user via WP ULike can be shown on a Page in Bricks.

Step 1

Install and activate WP ULike.

By default, the plugin will be active for the post post type. To change this, go to the Content Types tab in the plugin's settings page and select your desired post types in the "Post Types Filter" field.

While there you can change the appearance of the like button and any others settings as needed.

Step 2

The default button position on single posts is after the content.

You may want to add a top margin to space it out a bit.

Edit your single post template with Bricks and add this at Settings (gear icon) → PAGE SETTINGS → CUSTOM CODE → Custom CSS:

.wpulike { margin-top: 2em; }

Step 3

View a few posts on the frontend and like them so we have some data for testing.

Create a Page called "My Profile" or "My Content" for showing the posts that the user has liked.

Add a Section and inside its Container Posts element or set up a Query Loop.

Use the query icon to select your post type. If this is for the built-in post post type, there is no need to make any changes since it is the default in Bricks.

If you'd like to add the like button in the loop, add this shortcode:

[wp_ulike]

Step 4

Let's filter the posts from the above to only those that the current user has liked.

Add this in child theme's functions.php or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Display 3 Category-related Posts and Supplement with the Latest Published Posts if Necessary

Display 3 Category-related Posts and Supplement with the Latest Published Posts if Necessary

In the Bricks Facebook group a user asks: Show latest 3 related posts based on category and IF THERE ARE NOT ENOUGH, fill the empty…
Pro
Previous Two Posts in Bricks Query Loop

Previous Two Posts in Bricks Query Loop

This Pro tutorial shows how we can modify the parameters of a Bricks query to limit the posts to the previous two whilst cycling to…