Tell us what you are trying to do?
I would like to display a link button for only the post author.
I have two custom post types (public listing) and (restricted listing). I placed editing form at the bottom of the post template(elementor). I would like to place a button which will be displayed only for the post author.
Is there any documentation that you are following?
https://toolset.com/forums/topic/show-a-button-only-current-user-author/
https://toolset.com/forums/topic/hide-show-tabs-only-current-user-author/
I created view by following topic above. But the condition does't work for me. When I put conditional tag, the button disappears.
What would be possibly wrong?
Is there a similar example that we can see?
What is the link to your site?
Hello and thank you for contacting the Toolset support.
You can add the attribute debug=true to the condition to get more details about it on the frontend:
[wpv-conditional if="('[wpv-current-user]' eq '[wpv-post-author]' )" debug="true"]
Link goes here
[/wpv-conditional]
This can help finding the issue with the condition.
If you still encounter issues with it, allow me temporary access to check this closely. Let me know what view or content template you are working on it. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
You are using the conditional inside a view that queries listing and returns the first one(limit 1). As you can see in this screenshot, it returns the post with ID 17569 "A Chinese Restaurant" hidden link
The view is being used inside an Elementor single post template. A view is not intended for this use case. As you can read in our glossary, a view is meant to query and display a list of posts. While you want to display the edit link in a single post page.
https://toolset.com/glossary/view/
I would suggest using the conditional shortcodes directly inside an editor widget, check this screenshot hidden link
Or you can put the conditional shortcodes inside an unassigned content template and include it inside Elementor using a shortcode:
[wpv-post-body view_template="Name or slug of the content template"]
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153372
With your help, I was able to fix my issue! I appreciate it so much!