GMUPF?=MU(aGR1^MUGRQMU`GvMU`0IpmMUPPIB`hMUI<gxMUI+vMU``@JpmMUPPJB`hMUJ<QMUpJJMUpPKgxMU@K+LHMUL>LHMUP>LHMUQ>觘UaUUU0U1U ara@*rUoZ`gaPja@ a  GMUPB?GMU`B?vMUPCp`hMUpC<=MUs CR ^MU8Cp`hMUC<HAMUpCgxMUC+vMUP0HDp oMU0PDtaVMU XDD0MUD<&fMU`D20MUD<LHMUF>⧘U⧘UHaȅaHa~⧘U~⧘U@aUa oZtaP৘UU ay⧘UGMUPN?=MU=`OR ^MU`OpmMUPPOB`hMUpO<QMUPpO=MUoZp(PR ^MU`@Pp`hMUP<QMUPPgxMU`P+LHMUQ>bMU@P*LHMUS>UU|LHMUU>ďa`ďaaGaYaa`{a@*rU oZXhapha@a++ha+ha@4U/GMUP<? MU=EFMUp=dMUpP?tvMUP?p`hMU?<&fMU`?2`hMU=<QMU`=JMU`P@sgxMU@+LMU` @QMU@bMU@@*sMU@h[MU@>LHMUA>a0aX৘U(UXUoZaa a8U8UTMUP/TMU`$/čMU01^MU0R ^MU0p`hMU0<QMUp0jMUp1{gxMU@1+LHMU02>vMUP (4pvMUp 85p`hMU5<&fMUP52`hMU4< YMU5>LHMU7>x觘U觘U觘Uaa@觘Uh觘U82 U2 Ua82 U2 UTMUPuaVMU`vD0MUv< ^MU`wpvMUPwp`hMUw< ^MU(wp`hMUw< Returns the alt text of the given id. * * @param int $id Attachment id. * * @return string */ public function alt_text_by_id( $id ) { if ( ! is_numeric( $id ) || empty( $id ) ) { return ''; } $alt = get_post_meta( $id, '_wp_attachment_image_alt', true ); return is_string( $alt ) ? $alt : ''; } /** * Returns the caption of the given id. * * @param int $id Attachment id. * * @return string */ public function caption_by_id( $id ) { if ( ! is_numeric( $id ) || empty( $id ) ) { return ''; } // Get caption by using core getter (post_excerpt). if ( $caption = wp_get_attachment_caption( $id ) ) { return $caption; } // Get caption by attachment meta data. $attachment_meta = get_post_meta( $id, '_wp_attachment_metadata', true ); if ( is_array( $attachment_meta ) && array_key_exists( 'image_meta', $attachment_meta ) && is_array( $attachment_meta['image_meta'] ) && array_key_exists( 'caption', $attachment_meta['image_meta'] ) && is_string( $attachment_meta['image_meta']['caption'] ) ) { return $attachment_meta['image_meta']['caption']; } // No caption found. return ''; } }