Help me disable author box from 1 author's post

Posted in: Newspaper
Post count: 42

Hi there,

I have enabled author box in posts settings, but I want the posts from just 1 author not to show the author box.

In my previous theme I have used a conditional tag to do this but I don’t know where to add the code.

Here is the code that i used in single.php:
before the authorbox div element:

<?php define (‘author_x’, ‘author no’);
$author_id = get_the_author_ID(); ?>
<?php if ( $author_id != author_x ) { ?>

And after the authorbox div element:

<?php } ?>

Can you please tell me where to add the code or what else to do in order to do it?

Regards

Post count: 20

I’m also interested in disabling the Author box on a per author OR per post basis.. Any help?

Thanks!

Post count: 780

Hello,
to hide the box for the author with id 1 http://screencast.com/t/upbichKQD
to hide the box for multiple authors: http://screencast.com/t/6T4yVnkHf


@rcraig232
I will add classes to them in the next update. To make it easier to hide the boxes via css. Until then, the method from above will work for you?

Post count: 20

That will work.

In the future.. in the post options for a post, might want a checkbox, “hide the author box in this post”

Thanks, great work.

Post count: 42

Hello Radu,

I think it worked:) Thanks and consider to add this option to the next update.

Regards

Post count: 42

Radu does this tweak work on Newspaper V3.

I tried to update the them today, but i can’t make it working.

Please let me know asap

G.

  • This reply was modified 12 years by Kaskarino.
Post count: 3343

Hi,
Use the if condition here from V3 http://screencast.com/t/ifEA6PxJ

Thanks!

Post count: 42

Marius can you please tell me what exactly to write?

I tried few things, but nothing worked.

G.

Post count: 3343

Hi,
Replace this line http://screencast.com/t/A4hd7Y2h7K with this code:

<?php
            if (
                $td_mod_single->post->post_author != 1 and
                $td_mod_single->post->post_author != 2 and
                $td_mod_single->post->post_author != 4 and
                $td_mod_single->post->post_author != 7
            
            ) {
                echo $td_mod_single->get_author_box();
            }
            ?>

That code will hide the author with ID 1, 2, 4 and 7

Post count: 42

Thanks a lot.

Viewing 10 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic.