Title: Write a function
Last modified: August 18, 2016

---

# Write a function

 *  Resolved [splitvan](https://wordpress.org/support/users/splitvan/)
 * (@splitvan)
 * [19 years ago](https://wordpress.org/support/topic/write-a-function/)
 * i want to write a function for author status:
 * but i’m a php newbie:)
    can someone help me?
 * It’s a very simple script that shows the authors status (like. newbie, junkie…)
 * i made a variable the_author_posts() ;
 * this is the code:
 *     ```
       <?php $var = the_author_posts()	;
       if ($var < 10) {
       	echo 'newbie';
       }elseif ($var < 20){
       	echo 'text20';
       }elseif ($var < 50){
       	echo text50';
       }elseif ($var < 100){
       	echo 'text100';
       }elseif ($var < 130){
       	echo 'text 130';
   
       } else {
               echo "textelse";
       }?>
       ```
   
 * I putted the whole code in the loop. but for all the authors i get the status
   of newbie.
 * I’m new to this, but can someone help me?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [19 years ago](https://wordpress.org/support/topic/write-a-function/#post-581043)
 * to start with ..and ive not actually tried your code or looked that closely..
 * look what you wrote:
 * `.......elseif ($var < 20){..`
 * thats not a range, and the person could be both a newbie and whatever less than
   20 is.
 * by the same tokem someone that has less than 130 posts might also have less than
   100, less than 50 ..etc..
 * see what I mean?
 *  Thread Starter [splitvan](https://wordpress.org/support/users/splitvan/)
 * (@splitvan)
 * [19 years ago](https://wordpress.org/support/topic/write-a-function/#post-581047)
 * yes i see what you mean, but what i need to use to make it work?
 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [19 years ago](https://wordpress.org/support/topic/write-a-function/#post-581058)
 * [http://www.village-idiot.org/archives/2007/06/16/author-stats-plugin/](http://www.village-idiot.org/archives/2007/06/16/author-stats-plugin/)
 *  Thread Starter [splitvan](https://wordpress.org/support/users/splitvan/)
 * (@splitvan)
 * [19 years ago](https://wordpress.org/support/topic/write-a-function/#post-581082)
 * superbe! i tried, but know i know that (20 >$var < 30) not works 🙂
    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Write a function’ is closed to new replies.

## Tags

 * [author](https://wordpress.org/support/topic-tag/author/)
 * [status](https://wordpress.org/support/topic-tag/status/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [splitvan](https://wordpress.org/support/users/splitvan/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/write-a-function/#post-581082)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
