Author Box Question

Posted in: Newspaper
Post count: 53

Hi,

I have disable the author box. I have two authors in my blog. One wants to show the author box on his post the other doesnt.
Is it possible to add “author box” in specific posts with html code in the end of the article? I have 400 posts and I want to add it only in 5 posts.

Post count: 322

A plugin might be best. I recommend StarBox. Works very well, looks better than 99% of those out there, is free (Plugin Repository), gives you easy options for where to display (natural position like the theme and in widgets), and allows you turn it off per author. Easier than including an if statement to check against the current author.

Post count: 388

The point about it being easier is true. But just in case having original box is strongly desired… 🙂

1. Find the ID of the user you want to hide by editing the user and looking in the address bar. E.g. you might see “http://yoururl…/wp-admin/user-edit.php?user_id=940” in which case the ID is 940.

2. In the Newspaper theme files go to includes/modules/module_modifier/td_module_blog.php.

3. Find the function that begins with:

    function get_author_box($author_id = '') {

        if (!$this->is_single) {
            return;
        }

        if (td_util::get_option('tds_show_author_box') == 'hide') {
            return;
        }

        if (empty($author_id)) {
            $author_id = $this->post->post_author;
        }

4. Add this after the part I just quoted:

      if ($author_id == '940') { // Replace with the ID you found
           return;
        }

That’s the if statement Kronos means and it just returns nothing for the author box if it’s the author you want to hide. Save and/or upload the file and check an article where you don’t want to see it.

P.S. That file can be modified in a child theme to survive theme updates automatically.

Post count: 46

Thank you for the code. It worked and is quite useful. Better that than displaying the link to the author of the plugin below each article

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