Hide author's box of a certain author

Posted in: Newspaper
Post count: 62

Author’s box below the post is a great thing but I find it unnecessary when the author is Administrator. So is there a way to hide the author’s box only for admin user?

Post count: 22421

Hello,

It can be done but only by editing the theme files as there is no setting for this.
You can replace this code: <?php echo $td_mod_single->get_author_box();?> with this one
<?php if (!current_user_can('edit_theme_options')) { echo $td_mod_single->get_author_box();}?>
And you can add it like so on each post template file: https://www.screencast.com/t/98szyfiMDbQ
You have to do this for each of the 14 post styles as each one has it;s own file (if you do not use all 14 just edit the ones you use on your site)

Thank you!

Post count: 62

Thanks but that removed the author’s box also from other authors, not just admin…

Post count: 22421

Hello,

Please replace the part of the code mentioning ‘edit_theme_options’ with ‘create_users’
Only the admin can create users so only the admin will be affected.

Thank you!

Post count: 62

I’m sorry but this is still hiding author’s box from all the authors…

Post count: 22421

Hi,

Ok, it seems we need a different approach to this.
You need to add an extra class at the author box wrap. You should edit the td_module_single_base.php core field and you should do this -> https://www.screencast.com/t/lAjMJPl7 The snippet of the code which has to be concatenated is here ->
. get_the_author_meta('display_name', $author_id) . ' After these changes, you should use a bit of CSS code and hide the author box for your certain author. Try the code below and place it in Theme panel->Custom CSS area.

The code is ->

.author-box-wrap.ziar_6{
display:none;
}

(ziar_6 is the name of my admin)

The result is here-> https://www.screencast.com/t/yDtNzUECOB

Thanks

Post count: 62

That works great!

Thank you

Post count: 114

Hi
I complete line 853 of td_module_single_base.php with:
$buffy .= '<div class="author-box-wrap ' . get_the_author_meta('display_name', $author_id) . ' ">';
And add in custom css:
.author-box-wrap.Maricel7{
display:none;
}
(with my administrator name)
But still I have the admin box in the post, that I don’t want.
There are some error?
Thanks!

Post count: 22421

Please provide a link to your site pointing at a post where you do not want the author box to show up so we can inspect it.
Thank you!

Post count: 114
Post count: 20688

Hi,

Please make sure you enter the code mentioned properly in the theme files, and use exactly the same syntax
https://www.screencast.com/t/U6VVZtzDLT
I have tested this method and it is working properly, the author ID is appearing as a class next to the author box wrap, in the code – https://www.screencast.com/t/4zOmkOuchnF
In your case the author name does not appear – https://www.screencast.com/t/DKwEOjaM
After you modify the code as indicated, you can use the css solution and hide the author box for that particular author.

Thanks

Post count: 114

Thank you very much, now it works! Maybe it was a part of the code in the php file, although it looked the same, I re-wrote it back and it worked.
Thanks again!

Post count: 62

I have updated the theme to 8.6 and I’m trying to do this again but there is no more

. get_the_author_meta(‘display_name’, $author_id) . ‘

in

td_module_single_base.php

Can you please give me some new instructions?

thanks

  • This reply was modified 8 years by dharma3d.
Post count: 20688

No need for new code, the same code will work. Enter it in the same location
https://www.screencast.com/t/LODZdgMWd
https://www.screencast.com/t/whII9Qm3SWUf
The author name will be displayed as a class on the author box
https://www.screencast.com/t/A8AJ8SQwe
This can then be used the same as before. Try it like this and it should work.

Thanks

Post count: 62

Yes, it works, thank you!

Post count: 32

hello,
Im have a problem hidden this user name:

“author-box-wrap Izquierda Web2 ”

I tried this:
.author-box-wrap.Izquierda-Web2 {
display:none;
}

And this:

.author-box-wrap.Izquierda_Web2 {
display:none;
}

Any idea? thanks a lot!

Post count: 20688

Hi,

It would be helpful if you could provide a link to a post, so I can take a look. Try it like this maybe

.author-box-wrap.Izquierda.Web2 {
display:none;
}

Thanks

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