fix: optimize CHRNX editorial media
This commit is contained in:
14 files changed
+252
-46
No files matched your search
@@ -30,6 +30,9 @@ function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '',
|
||||
$decorative = '' === $alt ? ' aria-hidden="true"' : '';
|
||||
$loading = 'eager' === $loading ? 'eager' : 'lazy';
|
||||
$priority = 'eager' === $loading ? ' fetchpriority="high"' : '';
|
||||
if ( 'music-collage' === $topic_slug ) {
|
||||
$sizes = '(max-width: 599px) 100vw, 720px';
|
||||
}
|
||||
|
||||
$markup = '<picture class="chrnx-responsive-portrait"' . $decorative . '>';
|
||||
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w" sizes="' . esc_attr( $sizes ) . '">';
|
||||
|
||||
+8
-7
@@ -624,13 +624,14 @@ function chrnx_get_related_post_ids( int $post_id, int $limit = 3 ): array {
|
||||
*/
|
||||
function chrnx_get_topic_art_asset( string $topic_slug ): string {
|
||||
$mapping = array(
|
||||
'research' => 'alter-ego-research.png',
|
||||
'code' => 'alter-ego-code.png',
|
||||
'literature' => 'alter-ego-literature.png',
|
||||
'music' => 'the-no-names-musician-cutout.png',
|
||||
'podcasts' => 'alter-ego-podcasts.png',
|
||||
'life' => 'alter-ego-life.png',
|
||||
'gaming' => 'alter-ego-gaming.png',
|
||||
'research' => 'alter-ego-research.png',
|
||||
'code' => 'alter-ego-code.png',
|
||||
'literature' => 'alter-ego-literature.png',
|
||||
'music' => 'the-no-names-musician-cutout.png',
|
||||
'music-collage' => 'the-no-names-collage.jpeg',
|
||||
'podcasts' => 'alter-ego-podcasts.png',
|
||||
'life' => 'alter-ego-life.png',
|
||||
'gaming' => 'alter-ego-gaming.png',
|
||||
);
|
||||
return isset( $mapping[ $topic_slug ] ) ? 'assets/images/' . $mapping[ $topic_slug ] : '';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user