wordpress - Exact same PHP only produces correct output once instead of twice -


the plugin being used events calendar pro, , website wordpress.

this code below isn't linking each 'past event' image it's relevant event. instead links homepage.

the titles of events link correct place however, same code being used in both places, i'm stumped.

any ideas?

<?php foreach( $events $event ) : ?> <div class="tribe-mini-calendar-event">     <div class="list-info">         <div class="tribe-events-event-image">             <a href="<?php tribe_event_link( $event ); ?>"><?php echo tribe_event_featured_image( $event, 'medium' ); ?></a>         </div>         <h2 class="tribe-events-title"><a href="<?php tribe_event_link( $event ); ?>"><?php echo $event->post_title; ?></a></h2>         <div class="tribe-events-duration">             <?php echo date_i18n( get_option('date_format' ), strtotime( $event->eventstartdate ) ); ?>         </div>     </div> </div> <?php endforeach; ?> 

thanks in advance.

======================== update

the html page generates past event

      <div class="tribe-events-event-image">         <a href="http://touring.valhallatavern.com/event/fimbulwinter-mmxiv/"></a>         <a href="http://touring.valhallatavern.com/"><img width="212" height="300" src="http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwintermmxiv-212x300.jpg" class="attachment-medium size-medium wp-post-image" alt="fimbulwinter mmxiv" srcset="http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwintermmxiv-212x300.jpg 212w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwintermmxiv-768x1087.jpg 768w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwintermmxiv-724x1024.jpg 724w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwintermmxiv.jpg 851w"           sizes="(max-width: 212px) 100vw, 212px"></a>       </div> 

while generates upcoming tours

    <div class="tribe-events-event-image">       <a href="http://touring.valhallatavern.com/event/between-the-buried-and-me-nz-tour-2016/">       <img width="212" height="300" src="http://touring.valhallatavern.com/wp-content/uploads/2016/02/btbm-212x300.jpg" class="attachment-medium size-medium wp-post-image" alt="btb&amp;m" srcset="http://touring.valhallatavern.com/wp-content/uploads/2016/02/btbm-212x300.jpg 212w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/btbm-768x1086.jpg 768w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/btbm-724x1024.jpg 724w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/btbm.jpg 1500w"         sizes="(max-width: 212px) 100vw, 212px"></a>     </div> 

so there homepage link being thrown in image function...

you have change :::: <?php tribe_event_link( $event ); ?> :::: <?php echo tribe_event_link( $event ); ?>

<?php foreach( $events $event ) : ?> <div class="tribe-mini-calendar-event">     <div class="list-info">         <div class="tribe-events-event-image">             <a href="<?php echo tribe_event_link( $event ); ?>"><?php echo tribe_event_featured_image( $event, 'medium' ); ?></a>         </div>         <h2 class="tribe-events-title"><a href="<?php echo tribe_event_link( $event ); ?>"><?php echo $event->post_title; ?></a></h2>         <div class="tribe-events-duration">             <?php echo date_i18n( get_option('date_format' ), strtotime( $event->eventstartdate ) ); ?>         </div>     </div> </div> <?php endforeach; ?> 

try code 2

<?php foreach( $events $event ) { ?> <div class="tribe-mini-calendar-event">     <div class="list-info">         <div class="tribe-events-event-image">             <a href="<?php echo tribe_event_link( $event ); ?>">                 <?php echo tribe_event_featured_image( $event, 'medium' ); ?>             </a>         </div>         <h2 class="tribe-events-title">             <a href="<?php echo tribe_event_link( $event ); ?>">                 <?php echo $event->post_title; ?>             </a>         </h2>         <div class="tribe-events-duration">             <?php echo date_i18n( get_option('date_format' ), strtotime( $event->eventstartdate ) ); ?>         </div>     </div> </div> <?php } ?> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -