Support

Account

Home Forums General Issues Events Manager with Advanced Custom Fields – Return Image URL

Helping

Events Manager with Advanced Custom Fields – Return Image URL

  • I use events manager together with advanced custom fields. I created my own events-list.php template file in which i use attributes from advanced custom fields and events manager.

    echo EM_Events::output(array('format'=>
    '<div class="col-md-4 col-sm-6 event">
    <img src="#_ATT{eventimage}" alt="Introbild Event" />
    <span>#_EVENTDATES</span>
    <B>#_EVENTLINK</B>
    <p>#_ATT{introtext}</p>, 
    <a href="#_EVENTURL">Zum Event</a><HR>
    </div>',
    'limit'=>10, 
    'pagination'=>1, 
    'scope'=>all));

    Now the problem is on line three #_ATT{eventimage} should get the event url from advanced custom fields but instead it gets the media/ attachement id like “180”. Anyone has an idea how to fix this problem?

    Thx for your help and best regards.

  • Is that exactly the code used to create the html for the image?

    <img src="#_ATT{eventimage}" alt="Introbild Event" />

    For image fields ACF only stores the ID of the image. The field settings tell it what to return. My guess is that the events plugin is just getting what is stored in the database.

    If this is the case then there are a couple of choices, maybe.

    the first would be to get the value from ACF before calling the above function and use the value returned from that for your code.

    If you can’t do that then your only hope is that there is a hook in the event plugin that will let you filter the content that is used for the image. I’m not familiar with the plugin and the hooks it provides.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.