I've looked at the documentation, and I found this code
It only works in some categories, is there something wrong?
I'm not sure if the code of categories is 'categories', how do I know?
<?php
$terms= get_the_terms( $post->ID, 'category');
$background_image = get_term_meta( $terms[0]->term_id, 'single_image_taxonomy', true );
if ($background_image) {
$link_image = wp_get_attachment_image_src( $background_image, 'full' );
$link_image_source = $link_image[0];
}
else {
$link_image_source = get_term_meta( $terms[0]->term_id, 'single_image_taxonomy', true );
}
if ( !empty( $terms ) ){
$term = array_shift( $terms );
}
?>
<div class="card-slider">
">
</div>
CSS
.card-slider {
position: relative;
overflow: hidden;
height: 300px;
width: 100%;
vertical-align: middle;
}
.thumbnail-cat {
object-fit: cover;
position: absolute;
top: 0;
height: 100%;
width: 100%;
}