• Resolved ramoshe

    (@ramoshe)


    On the user profile, under the “Posts” tab it shows cards with each post that have the featured image. However, since my featured images are square and not 16 x 9 it is distorting them to fit on the card.

    Is there a way to change this? I’ve explored the template files, but can’t figure out exactly where the size is being set.

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    You can do that by overriding the template file in your currently active theme and modifying the class ’embed-responsive-16by9′ in the template file to whatever aspect ratio you need from bootstrap documentation here: https://getbootstrap.com/docs/4.0/utilities/embed/

    Let me know if it helps or not.

    Regards,
    Patrik

    Thread Starter ramoshe

    (@ramoshe)

    Thank you! That class name was exactly the key I needed.

    I actually ended up writing a JavaScript snippet to swap out the class names. For anyone who needs it in the future:

    add_action( 'wp_footer', function () { ?>
    <script>
    	const postImages = document.querySelectorAll('.embed-responsive-16by9');
    	postImages.forEach(image => {
    		image.classList.remove('embed-responsive-16by9');
    		image.classList.add('embed-responsive-1by1');
    	});
    </script>
    <?php } );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Posts Profile Tab featured image aspect ratio’ is closed to new replies.