Support

Home Forums Event Espresso Premium Featured Image in Widget

Featured Image in Widget

Posted: September 4, 2012 at 2:45 pm

Viewing 4 reply threads


Michael Cronin

September 4, 2012 at 2:45 pm

I’m trying to display the featured image in the sidebar, along with the title and date of the event. The widget doesn’t support this by default. Is there some custom code I can throw in my sidebar.php file to loop through and show the next X number of events with the featured image?


Chris Reynolds

  • Support Staff

September 4, 2012 at 5:44 pm

You might be able to do this by editing the widget.php template. You’d want to add something like this:

<img src="<?php echo do_shortcode('[EE_META event_id="' . $event_id . '" type="event_meta" name="event_thumbnail_url"]'); ?> class="alignleft" width="50" height="50" />

Obviously tweaked to suit your theme. The only downside with this (which was brought up in another thread) is that you only have the full size image to work with, which isn’t great if you’re then resizing it to thumbnail size to display it in a widget.


Michael Cronin

September 6, 2012 at 10:56 pm

Hmmm… what about product updates? Won’t this get overridden when we update the plugin? I was hoping for more of a hook or something as we are developing this for a client who ultimately will be responsible for plugin updates.

Out of curiosity… why don’t any of the images placed inside the editor section of an event get “attached” to the post like any other post? This would allow for people to get those attachments and work with whatever size they want, or use custom image sizes since the image gets crunched.


Michael Cronin

September 6, 2012 at 10:59 pm

Or, is there even a way to pull the ID of the featured image? This way we could use wp_get_attachment_image() to get the desired image size. Though now I guess I’m asking for two separate things. A hook for adding the featured image to the sidebar, and retrieval of the featured image ID. Sorry to double post, but I just thought of this now.


Chris Reynolds

  • Support Staff

November 3, 2012 at 10:26 am

Sorry for not seeing this sooner. I’m digging though old forum topics today…

To answer your questions:

Won’t this get overridden when we update the plugin?

Not if the widget.php you’ve modified is uploaded to /wp-content/uploads/espresso/templates.

Or, is there even a way to pull the ID of the featured image?

wp_get_attachment_image() won’t work because we’re not using the WP featured image functionality for those thumbnails. We’re using the uploader but the url to the image is being stored as event meta (which is similar to postmeta, except…different…because they aren’t posts and aren’t in the posts table).

Viewing 4 reply threads

The support post ‘Featured Image in Widget’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso