Displaying custom image works in one EO template, but not in another

WordPress Event Management, Calendars & Registration Forums General Question Displaying custom image works in one EO template, but not in another

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 2 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40686

    Hi! On my event archive pages of film listings, it displays the (square) event thumbnail for each film. However I have a custom field containing a movie-poster image which I’d like to use instead.

    In shortcode-event-list.php (in my child theme of course), I’m successfully using the following code to display that:

    <?php
                    $image_ids = get_post_meta($post->ID, 'poster');
    
                    foreach ($image_ids as $image)
                        {
                            $myupload = get_post($image);   
    
    
                            if (is_front_page()) {                      
                                echo  wp_get_attachment_image( $image, 'homepage-thumb' );
                            } else {
                                echo  wp_get_attachment_image( $image, 'poster-thumb' );
                            }
                        }
                ?>
    

    And here’s an example of what that currently looks like:

    https://staging-vjfforg.kinsta.cloud/festival-archives/2018-festival/

    However, placing the same code in eo-loop-single-event.php (for display of tag archives) does not produce the same result. It shows the poster image, but at its original size, which varies tremendously and makes a mess of the layout. Here’s an example (I’ve added the above code to show what it produces, but left the original thumbnail code there as well):

    https://staging-vjfforg.kinsta.cloud/events/tag/drama/page/2/

    Can you advise why this is? I’ve tried so many things, and done so much digging into this, but still no luck.

    Thanks so much!

    Adam

    Adam Abrams
    #40703

    Hi Adam,

    Thumbnails are a WordPress feature, so there’s nothing the plug-in is doing here.

    However, the image widths in the first page are being sett by the following CSS:

    div.eo-event-cat-vjff img.attachment-poster-thumb, body.archive .archive-film-event img {
      float: left;
      border: 1px solid black;
      display: block;
      width: 185px;
      margin-right: 15px;
    }
    

    and it appears to be done by the theme (or perhaps a customization you’ve made through the theme ): https://staging-vjfforg.kinsta.cloud/wp-content/et-cache/global/et-divi-customizer-global.min.css?ver=1642030696

    If you add the following CSS to your theme for the event page, then it should style the image accordingly:

    .eo-event-details img.attachment-poster-thumb {
      float: left;
      border: 1px solid black;
      display: block;
      width: 185px;
      margin-right: 15px;
    }
    
    Stephen Harris
    #40708

    Thanks Stephen! In the end I finally realized that the solution was something entirely different – I was running a new theme that lacked the code from the previous one, which creates the custom thumbnail size being requested. Nothing to do with EO! Sorry to take up your time with this one!

    Adam Abrams
    #40712

    No worries, glad you got this working

    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.