0

I have created a field for the homepage called icon_font. I now want to access that field in my template. What is the best way to do that? Do I have to use a for loop (even though there is only one homepage)? Any help is appreciated.

Thanks,

Moshe

EDIT: Note, the template in question is NOT my homepage template, but rather a different template which relates to a different section.

2

First you'll need to get your homepage entry:

{% set homepage = craft.entries.slug('homepage').first() %}

Then, you can call the field you need from homepage:

{{homepage.entry_icon}}
| improve this answer | |
0

If your homepage is a Single section and you've checked the "This is for the homepage" checkbox in the section's settings, all you should need to do is:

{{ entry.icon_font }}

From the template you specified in the section's settings.

| improve this answer | |
  • That works on my homepage template, but I am trying to access this from a different page template related to a different section (sorry I didn't mention that above). – Moshe Feb 19 '15 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.