You may or may not have heard of shorthand if/else statements, but they do exist, and trust me they make things SO much more ordered in your code when used in the right way.
This is the Shorthand version - below this, if you cannot work it out for yourself is a nice description.
Description of how this actually works
We all (i would hope) know the normal way of writing if/else statements (here is a recap just incase)
That sort of statement is great for in the body of your code, but when want a dynamic selector within your HTML code, it gets very messy.
EG:
Now - that is alot to write and will make your HTML form look a total mess, this is where the shorthand comes in. It allows us to write the same thing inline
Look:
As you can see - there is a huge difference in the amount of code - and if Wordpress formatted it nicely - it would look loads better!
And the all important Explanation!
So - $myGender is the variable we are checking, in this case we are checking to see if $myGender == ‘male’
The questionmark (?) seperates the ‘answers’.
The first ‘answer’ is what is set/displayed when the query is true, the second is if the query is false.
This is the equilivent to :
Hope that helps some of you out!