How to check user login status in custom post layout?


On product archive page, I only want to show the shopping cart part when user has logged in. Because it’s all using custom codes, I can’t set the visibility from row or module settings.
I checked documents regarding conditional logic, but didn’t find any similar examples.
Any help would be appreciated!

I have solved it. For someone who may have the same question, here is the solution:

  1. Install a free plugin: Custom Content Shortcode Download Url: Custom Content Shortcode – WordPress plugin |
  2. Wrap the codes that you only want logged in users to see with this:
    [is login] [/is]
    For example:
    [is login] You are logged in. [/is]

Worked for me.

[wpbb site:logged_in]

1 Like

Thank you so much! It worked too.