• Resolved grw1

    (@grw1)


    Hey

    I’ve just installed this plugin and it seems to be exactly what I’m looking for. I’ve got some issues with general background-positions, which doesn’t suit all images. Is it possible to use the focus point in template files?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WP Company

    (@wpcompany)

    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?

    Plugin Author WP Company

    (@wpcompany)

    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.

    Plugin Author WP Company

    (@wpcompany)

    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.

    • This reply was modified 3 weeks, 2 days ago by WP Company.
    • This reply was modified 3 weeks, 2 days ago by WP Company.
    Thread Starter grw1

    (@grw1)

    Hello

    Thanks for the quick update – it works like a charm ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.