Support » Fixing WordPress » Conditional Tags For Author Page

  • dcunited55


    I’m trying to get an author profile page setup correctly using conditional tags.

    All of the author bios are filled out such as jabber info, yahoo, url, email..etc.

    I have added in two custom profile fields for ‘bio in engligh’ and ‘bio in french’. I need the author page to display the content for both the engligh and french bios if they are BOTH filled in on the author bio page. Show only the french is there is nothing on the english bio, and show only the english if there is nothing on the french bio.

    Basically it will show the appropriate bio depending on the fields filled in by my author.

    Any ideas?

    Thank you!

Viewing 1 replies (of 1 total)
  • NateJacobs


    This should get you started. Check if the custom fields are empty and depending on outcome display the appropriate bio information. You will need to pass an author_id unless you use the conditional tags in the loop. Read more about the_author_meta in the Codex.

    function mysite_author_bio( $user_id )
    	$french_bio 	= get_the_author_meta( 'french_bio', $user_id );
    	$english_bio 	= get_the_author_meta( 'english_bio', $user_id );
    	if( !empty( $french_bio ) && !empty( $english_bio )  )
    	{ /*display both bios*/ }
    	else if ( !empty( $french_bio ) && empty( $english_bio )  )
    	{ /*display the french bio*/ }
    	else if ( empty( $french_bio ) && !empty( $english_bio )  )
    	{ /*display the english bio*/ }
    	{ /*do something if neither are set*/ }
Viewing 1 replies (of 1 total)
  • The topic ‘Conditional Tags For Author Page’ is closed to new replies.