Skip to content

Instantly share code, notes, and snippets.

@andreiglingeanu
Last active March 23, 2023 07:09
Show Gist options
  • Save andreiglingeanu/cf75e265f1ef3f54542d73ca7824fca9 to your computer and use it in GitHub Desktop.
Save andreiglingeanu/cf75e265f1ef3f54542d73ca7824fca9 to your computer and use it in GitHub Desktop.
<?php
add_filter(
'blocksy:archive:render-card-layers',
function ($layers, $prefix, $featured_image_args) {
$post_id = get_the_ID();
if (
get_post_type($post_id) !== 'blogger-template'
||
has_post_thumbnail($post_id)
) {
return $layers;
}
$bt_image_url = rwmb_get_value('bt_image_url', $post_id);
$alt_text = 'Check Out ' . rwmb_get_value('bt_name', $post->ID) . ' Premium Blogger Template';
$featured_image_args['html_atts']['class'] = $featured_image_args['class'];
unset($featured_image_args['class']);
$featured_image_args['img_atts'] = [];
$featured_image_args['img_atts']['alt'] = $alt_text;
$layers['featured_image'] = blocksy_simple_image(
$bt_image_url,
$featured_image_args
);
return $layers;
},
10, 3
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment