0

I've recently added a new field into the User Profile section of my blog So that I may define the gender of the user.

On the author bio section I have this code:

$authorgender = strtolower(get_the_author_meta('gender'));

if ($authorgender = "male") {
    $genderoutput = "his";
} else {
    $genderoutput = "her";
    };'

And the place i'm using it is:

  <p><a href="<?php the_author_meta('url'); ?>" target="_blank" title="<?php the_author(); ?>'s website (new window)">Check out <?php echo $genderoutput; ?> website</a>

I have two users, One myself which I changed the gender to 'Male' and one a random woman called sally-louise-fredericke-swann and her gender was set to 'Female'.

However, the $genderoutput generates 'his' for both users. Not happy :/

Any Ideas?

1 Answer 1

3
if ($authorgender = "male") {

Needs to be

if ($authorgender == "male") {

== is a comparison operator http://www.php.net/manual/en/language.operators.comparison.php

= assigns the value to the variable http://www.php.net/manual/en/language.variables.basics.php

1
  • Holy crap, im so tired and thank you very much! more caffeine needed me thinks - never a good idea to try and code after a 10 hour shift in a restaurant. Commented Jan 20, 2012 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.