[ad_1]
Thank you @ferdman for your rating and your kind words. I’ll create a snippet code for this use case very soon.
Thanks, Phi.
Hi @ferdman, below is the snippet code for your request, please replace your_image_field_name with your real fieldname.
add_filter(
'meta_field_block_get_block_content', function ( $content, $attributes, $block, $post_id ) {
$field_name = $attributes['fieldName'] ?? '';
if ('your_image_field_name' === $field_name) {
return sprintf('<a href="https://projectdmc.org/support/topic/link-meta-field-to-post-in-query-loop-2/%1$s">%2$s</a>', get_permalink($post_id), $content);
}
return $content;
}, 10, 4
);In the future version, I’ll consider adding a ‘Link to post’ setting for some field types like images, text, etc.
Please feel free to contact me if you need help with this block in future.
Phi.
