-1

I am using parallax.js and this is how It gets added. It works fine when I direct link to an image, but I would like each post's featured image to display here instead.

<div id="featured" data-parallax="scroll" data-speed="0.1" data-natural-width="2304" data-natural-height="1536" data-ios-fix="true" data-position="top" data-bleed="10" data-image-src="<?php the_post_thumbnail(); ?>">

Your help is appreciated, Thanks.

0

I asked a friend for help and solved it like this

<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'NAME_OF_THE_THUMBNAIL_KIND' ); $url = $thumb['0']; ?>

<div id="featured" data-parallax="scroll" data-speed="0.1" data-natural-width="2304" data-natural-height="1536" data-ios-fix="true" data-position="top" data-bleed="10" data-image-src="<?php echo $url ?>">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.