' . $output . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } // /display /** * Featured image. * * @since 1.0.0 * * @param string $image_size * * @return string */ public static function image_featured( string $image_size ): string { // Pre /** * Bypass filter for WebManDesign\Michelle\Entry\Media::image_featured(). * * Returning a non-false value will short-circuit the method, * returning the passed value instead. * * @since 1.0.0 * * @param mixed $pre Default: false. If not false, method returns this value. * @param string $image_size Image size to display. */ $pre = apply_filters( 'pre/michelle/entry/media/image_featured', false, $image_size ); if ( false !== $pre ) { return $pre; } // Variables $output = $attachment_image = ''; $post_id = get_the_ID(); $image_id = ( is_attachment() ) ? ( $post_id ) : ( get_post_thumbnail_id( $post_id ) ); // Processing if ( has_post_thumbnail( $post_id ) || ( is_attachment() && $attachment_image = wp_get_attachment_image( $image_id, $image_size ) ) ) { if ( Component::is_singular( $post_id ) || is_attachment() ) { $link_url = wp_get_attachment_image_src( $image_id, 'full' ); $link_url = $link_url[0]; } else { $link_url = get_permalink(); } /** * Filters featured image link URL. * * @since 1.0.0 * * @param string $link_url Image link URL. * @param int/null $post_id Post ID. * @param int/null $image_id Thumbnail ID. */ $link_url = (string) apply_filters( 'michelle/entry/media/image_featured/link_url', $link_url, $post_id, $image_id ); $output .= '
'; if ( ! empty( $link_url ) ) { $output .= ''; } if ( $attachment_image ) { $output .= $attachment_image; } else { $output .= get_the_post_thumbnail( null, $image_size ); } if ( ! empty( $link_url ) ) { $output .= ''; } $output .= '
'; } // Output return $output; } // /image_featured /** * Entry thumbnail link. * * @since 1.0.0 * * @param string/null $link_url * * @return string */ public static function link( $link_url ): string { // Processing if ( Component::is_singular() ) { $link_url = ''; } // Output return (string) $link_url; } // /link /** * Disable media on single post page if needed. * * @since 1.0.0 * * @param mixed $pre * * @return mixed */ public static function disable_single( $pre ) { // Processing if ( Component::is_singular() ) { $pre = ''; } // Output return $pre; } // /disable_single }