Conditional logic not working on wordpress