Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
Forked from andreiglingeanu/test.php
Created March 23, 2023 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdmrhn/21f8460e9d89b7a9c14445163ae85909 to your computer and use it in GitHub Desktop.
Save tdmrhn/21f8460e9d89b7a9c14445163ae85909 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