Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Template:ifdef

This template provides branching without Extension:ParserFunctions for simple "if defined then do" statements without else part. It is the opposite of Template:ifndef.

Usage

{{ifdef|value|result}} yields result  if value  isn't blank.

It uses the code {{{1{{{1|}}}|{{{2|}}}}}}.

Examples

Code Result
{{ifdef|x|y}} y
{{ifdef||y}}
{{ifdef|2=y}} y
{{ifdef|x}}
{{ifdef|}}
{{ifdef}}

Substitution

Convenient of the parameter default mechanism is that substitution works also, without any extra code.