Variable doesn't exist
The problem is that you are setting career inside of the if statement. Defining it there won't make it available for your elseif statement.

I've trimmed down your code so you can see exactly what the problem is:

{% set entries = ... %}

{% if entries|length &gt; 0 %}

    {% set career = ... %}

{% elseif career %}

    ...

{% endif %}


If you want career to be available to your elseif statement, you need to define it before your if statement.