0

I'm trying to make an all-in-one feed for the home page of a site that would pull together all the latest entries (whether they be blog posts, events etc.)

So I've got a entries loop that goes like so:

{exp:channel:entries 
    channel="posts|calendar_events"
    sticky="no"
    status="open|featured"
    limit="10"
    disable="categories|member_data|category_fields"
}

calendar_events being the channel created by the Solspace Calendar add-on. The channel field with of Calendar type is called event_time. I want to know if there was a way to display the event start times and end times through the entries tag using my event_time variable.

When I just put {event_time} it displays the Calendar ID. I'd rather not be embedding a template for every event that appears but I suppose I could use the event_time and/or entry_id to display the time via embed variables.

Any help would be great! Thank you!

1

Calendar data can only be pulled from Calendar tags. The Calendar widget custom field does not output any useful data (unless you need the calendar ID) if directly used in {exp:channel:entries} like a regular field variable (eg. {event_time}).

You could pass the {entry_id} from {exp:channel:entries} into the event_id="" parameter of a Calendar tag, such as {exp:calendar:cal} or {exp:calendar:events}. Quick example (you might need to tweak for your own situation):

{exp:channel:entries 
    channel="posts|calendar_events"
    sticky="no"
    status="open|featured"
    limit="10"
    disable="categories|member_data|category_fields"
}

   {if channel_name == "calendar_events"}
      {exp:calendar:events event_id="{entry_id}"}
         Very first start date: {event_first_date format="%Y.%m.%d"}
         Very last end date: {event_last_date format="%Y.%m.%d"}
      {/exp:calendar:events}
   {/if}
{/exp:channel:entries}
| improve this answer | |

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.