WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Showing medium image on single event page (10 posts)

  1. Zoee
    Member
    Posted 2 years ago #

    Hi all, I want to show the medium image on the single event page rather than the cropped thumbnail, I've tried using:

    $medium = wp_get_attachment_image_src($picture->ID, 'medium', false);

    to get the URL and other variations but it just returns blank!

    Any ideas?

    Cheers!

    http://wordpress.org/extend/plugins/the-events-calendar/

  2. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Hey there epixmedia. Thanks for the note here; we should be able to help you out here, but can you clarify what exactly you're trying to do? When you say "medium image," you mean the mid-size offering WP presents upon uploading an image? And are you adding this via the "featured image" functionality, or just dropping it into a post's entry body?

    Let me know your thoughts here and we can try to guide you appropriately.

  3. Zoee
    Member
    Posted 2 years ago #

    Hi Rob, yes I want to use the medium image already created and stored when the image was uploaded.

    I'm also adding the image as a featured image, its then automatically displayed in the post (using the thumbnail code that's in the template). I want to change this thumbnail code to display the medium image.

    Cheers :)

  4. Zoee
    Member
    Posted 1 year ago #

    Are you able to help me with this one at all Rob?

  5. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 1 year ago #

    Hey there epixmedia. Thanks for the follow-up; we generally only have the bandwidth to hit the forum here at WordPress.org once a week or so....my apologies for taking until now to get back to you. (We do provide daily & generally more comprehensive support for PRO users at the tri.be forums, if you ever find yourself in need of a quick turnaround).

    But as for this issue....we should certainly be able to point you in the right direction. The specific question is outside my area of expertise so I have asked a member of our dev team to take a look when they hit the forums this afternoon. Stay tuned and my apologies again for the delay thus far.

  6. Zoee
    Member
    Posted 1 year ago #

    Thanks Rob, I'll await their feedback!

    I should be upgrading to the pro version later in the year as we may need to write a module to work with your system!

  7. jonahcoyote
    Member
    Posted 1 year ago #

    Hey epixmedia,

    You may not be getting anything because you are trying to get a picture with an ID that has not been set ($picture->ID) - where is $picture being populated? If it's not being assigned to the current event ID, then it won't work... So if you've got this in a custom loop you'll need to make sure that $picture is the array of objects being returned for the query. Which it won't be by default. Try $event->ID instead.

    By default the single event template uses the_post_thumbnail() to display the featured image for an event. If you look at the codex for: http://codex.wordpress.org/Function_Reference/the_post_thumbnail - you'll see that you can pass size parameters to that function to determine what size image is used. So you should be able to use the following:

    the_post_thumbnail('medium');

    Does that help?

  8. jonahcoyote
    Member
    Posted 1 year ago #

    also, make sure if you are editing the single event template that you make a copy of /wp-content/plugins/the-events-calendar/views/single.php and place in an 'events' folder to preserve your changes.

  9. Zoee
    Member
    Posted 1 year ago #

    Thanks!

    the_post_thumbnail('medium');

    Worked a treat, surprised I didn't spot this on my initial hunt!

    My files are already copied to my theme folder so no worries there :)

  10. jonahcoyote
    Member
    Posted 1 year ago #

    Awesome to hear epixmedia! Let us know if there's anything else we can help you with.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic