I am working on an Expressionengine site at the moment, the client would like the ability to choose if there's a custom phone number in the sidebar of the page and if non is entered it just shows the default GV phone number. I have added the channel fields to each page and written a conditional statement but can't get it to work. My statement looks like this;
{if get_in_touch_jobs_phone}
<p>{get_in_touch_jobs_phone}</p>
{if:elseif get_in_touch_media_phone}
<p>{get_in_touch_media_phone}</p>
{if:elseif get_in_touch_pages_phone}
<p>{get_in_touch_pages_phone}</p>
{if:elseif get_in_touch_staff_phone}
<p>{get_in_touch_staff_phone}</p>
{if:elseif get_in_touch_volunteering_phone}
<p>{get_in_touch_volunteering_phone}</p>
{if:else}
<p>{gv-global-telephone}</p>
{/if}
I'm trying to make the statement go through each pages custom phone field and check if it is there, if not it should move to the next statement and check if anything's there until it reaches the 'catch-all' else of using the global phone number.
For some reason this code always outputs the global phone number even if the custom phone field has been filled out, so I presume my elseif's syntax is not quite right, could anybody give me some advice/pointers as what I can do to get this working?
EDIT: I have now got this code which is working much closer to what I am looking for.
Certain pages won't take the custom numbers entered and will just show the global number even if there is a custom number set on a page, here is the code at the moment;
{exp:channel:entries limit="1"}
{if get_in_touch_jobs_phone}
<p>{get_in_touch_jobs_phone}<br />
{if:elseif get_in_touch_media_phone}
<p>{get_in_touch_media_phone}<br />
{if:elseif get_in_touch_pages_phone}
<p>{get_in_touch_pages_phone}<br />
{if:elseif get_in_touch_staff_phone}
<p>{get_in_touch_staff_phone}<br />
{if:elseif get_in_touch_volunteering_phone}
<p>{get_in_touch_volunteering_phone}<br />
{if:else}
<p>{gv-global-telephone}<br />
{/if}
{/exp:channel:entries}
get_in_touch_jobs_phone
?? Also, are you within a channel entries loop? Can you include the entries tag your using and let us know exactly how you are entering the other phone numbers (are they fields on an entry in a channel???