Yes ofcourse. You can use like this:
$image_id = get_post_thumbnail_id() ?? null;
if($image_id) {
$image = wp_get_attachment_image($image_id, 'full');
echo $image;
}
<style>
img {
height: 200px;
width: 100%;
object-fit: cover;
}
</style>
Thread Starter
grw1
(@grw1)
Hey!
Thanks for the quick reply.
My problem is when I use the images as backgrounds with background-size: cover and background-position: center. Is it possible to get the focus point set in Media Library for each image, so I can set the position specifically for each image?
The plugin previously only applied it to the <img> element.
Thanks to your feedback, we’ve added a new function in the latest update (1.3) that now also applies it to background images, like this:
<div class="myelement" style="<?= MFP_Background($image_id); ?>">
</div>
This update adds the cover, background-image, and background-position.If you’d like to add it without the background-image, you can use this:
<div class="myelement" style="<?= MFP_Background($image_id, false); ?>">
</div>
We hope this update makes things easier for you. If you have any feedback, feel free to let us know.
We believe this new addition resolved your issue. If you find that you still have problems please open another ticket.
If you enjoy using our plugin, consider leaving a review.
Thread Starter
grw1
(@grw1)
Hello
Thanks for the quick update – it works like a charm 🙂