Returning 2 events for a single date based on venue

WordPress Event Management, Calendars & Registration Forums General Question Returning 2 events for a single date based on venue

This topic contains 18 replies, has 2 voices, and was last updated by  Colin Frangos 10 years, 6 months ago.

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #12130

    Hi Colin,

    The url should be given in $large_image_url[0]. (see codex for wp_get_attachment_image_src()).

    Stephen Harris
    #12133

    I’m making this confusing by not posting the whole code snippet. Here it is:

    <?php if ( has_post_thumbnail( $upstairs_event->ID ) ) {
                        $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
                       echo '<figure class="venue-flyer">';
                            echo    get_the_post_thumbnail( $upstairs_event->ID , 'home');
                                echo '</figure>';   
                    } ?>

    The problem I’m having is in returning the URL for the large featured image in the link so that I can lightbox it. I’m not sure how to get the proper $attachment_id, and it isn’t working with with get_post_thumbnail_id, presumably because we’re outside the loop.

    Colin Frangos
    #12151

    Try:

    <?php 
         if ( has_post_thumbnail( $upstairs_event->ID ) ) {
              $large_image_src = wp_get_attachment_image_src( get_post_thumbnail_id(  $upstairs_event->ID ), 'large');
              $large_image_url = $large_image_src[0];
              echo '<figure class="venue-flyer">';
                   echo get_the_post_thumbnail( $upstairs_event->ID , 'home');
              echo '</figure>';   
         } 
    ?>
    Stephen Harris
    #12167

    This works – thanks for your patience. My original error was pretty obvious after a weekend off.

    Colin Frangos
Viewing 4 posts - 16 through 19 (of 19 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.