Hiding user avatar and name for specific authors

Posted in: Newspaper
Post count: 2

Hello

We are running a huge newspaper with your theme. We want to hide some of the authors name and avatar from showing on posts(not all of them). we also want to see their name on admin panel. Just hiding the name from online post. Can you provide any options for it?

Thank you

Post count: 20688

Hi,

So the author name here – https://www.screencast.com/t/e1baDzSU5 and also the author box
https://www.screencast.com/t/blQ4qnrnmHm

On way of doing it only for some posts, would be to create/import a cloud post template and remove the author name and author box elements from it, then apply it to the posts you want
https://forum.tagdiv.com/tagdiv-cloud-library-plugin/
These are the available cloud post templates – https://affiliate.tagdiv.com/#/load/Single
There you can preview and even edit them with the composer for testing.

Or you could set a condition in the post template used for the post. Something like this for post template default
Author name – https://www.screencast.com/t/4EDnOqygT
Author box – https://www.screencast.com/t/kQsBApk4N
So if not the author IDs for example 1 and 3 display the author name and author box. Author IDs can be seen like this for example – https://www.screencast.com/t/TgCPD80eT

So code without condition – https://www.screencast.com/t/XdfEGwqEkKoX
With condition will be as above. I found this example here
https://premium.wpmudev.org/forums/topic/how-to-write-if-author-id-1-do-the-action-in-php

I have tested this briefly and it seems to work. Here is the code for it
Author name – https://pastebin.com/AW0WUB4t
Author box – https://pastebin.com/VRknYdAF
Replace the default line of code for each with the new code. If you have a development copy of the website test this there before, if possible. If you have more authors add them like this – https://www.screencast.com/t/vTANMPJeG0W

This will have to made in the post template file, depending on what post template the post uses. The template files can be modified in a child theme if you have one, so they will not be lost after a theme update.

Thanks

Post count: 2

Thank you for your answer. I’m trying to edit loop single. I will inform if it works.

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.