I wish to hide the "author" of posts if the author is the "staffreport" user.
This works on the single post:
[wpv-conditional if="( '[wpv-post-author] info='user_login'' ne 'staffreport' )"]<div class="author">[wpv-post-author]</div>
[/wpv-conditional]
However, if I add the same on the archive, I cannot get the condition to match. Nothing prints for any item.
[wpv-conditional if="( '[wpv-post-author] info='user_login'' ne 'staffreport' )"]<br />by [wpv-post-author][/wpv-conditional]
Is there something that I must do differently to test for the post author when it's the current item in the loop rather than the page being viewed?
Hello @webD-3, welcome to the Toolset support Forum!
I did a quick test on my test website and it worked. If you remove the conditional fields, does it display the name of the author (wpv-post-author shortcode)? Have you added the shortcodes inside the loop (and not outside of it)?
If possible please send us some screenshots of the back-end of the view.
All the best,
Diego
Diego, thank you for the reply.
The content displays as expected when the conditional field is removed.
As an additional step, I copied the code from the working single post content template and pasted it into the archive content template, to make sure I didn't have any extraneous characters or other errors. This is the code:
[wpv-conditional if="( '[wpv-post-author] info='user_login'' ne 'staffreport' )"]<div class="author">[wpv-post-author]</div>
<div class="title">[types usermeta='staff-title' user_is_author='true'][/types]</div>[/wpv-conditional]
Screenshots of the two content templates are attached.
Thank you for your assistance.
Hi there,
Please send us access to your WordPress dashboard (website URL, login and password) I'll check and do some tests. - Please use the private field to send the sensitive data - do not post if you do not see it.
It would be better if you give me a test site rather than the live site.
IMPORTANT Please backup a working copy of site files and database before.
Please also send us a link to the view and to the page with the issue (archive).
Kind regards,
Diego
Hi there,
I was able to fix this by using the author name in the conditional tag (instead of the author login):
[wpv-conditional if="( '[wpv-post-author]' ne 'Staff Report' )"]
<div class="author">[wpv-post-author]</div>
<div class="title">[types usermeta='staff-title' user_is_author='true'][/types]</div>
[/wpv-conditional]
After that, it works as expected on both single/archive pages:
- hidden link
- hidden link
- hidden link
If you need more help just let me know.
Kind regards,
Diego
My issue is resolved now. Thank you!