Custom Placeholder: Event Image using alt tag...
  1. <?php
  2.  
  3. add_filter( 'em_event_output_placeholder', 'em_event_image_alt', 100, 3 );
  4. function em_event_image_alt( $replace, $EM_Event, $result ) {
  5.  
  6. if ( $result === '#_EVENTIMAGECUSTOM' ) {
  7.  
  8. $image_id = get_post_thumbnail_id( $EM_Event->post_id );
  9.  
  10. if ( $image_id ) {
  11. $alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true );
  12.  
  13. $replace = wp_get_attachment_image(
  14. $image_id,
  15. 'medium',
  16. false,
  17. array( 'alt' => $alt )
  18. );
  19. }
  20. }
  21.  
  22. return $replace;
  23. }
Pasted 2026-09-11 07:46:34

Short link: