简体   繁体   中英

Wordpress: Author page PHP If viewing xxxx author page show this xxxxx

I'm making custom author pages for a website with 3 authors. The page has a list of posts by the author, bio and social links.

I want to add a special feature that if it is certain's author page, lets say author id 8, it outputs some code. if not, do nothing. can someone please give me some advice on how to perform this conditional php call?

this is to add some information inside the php file with some details of the author.

You need to run the is_author() function like this:

if( is_author('8'); ) {
    echo 'somehthing';
}

You may refer to the Codex documentation about conditional tags, you may find this specially useful: http://codex.wordpress.org/Conditional_Tags#An_Author_Page

You can use those conditionals inside your author template to display the conditional information you want. In this case wnat you want is something like:

if (is_author( '8' ))
{
    //Do something cool
}

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM