You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REFERENCE FROM THE ATTRIBUTE ABOVE, INSTEAD OF USING A LINK OF AN IMAGE, HOW CAN I SET THE DATA-CURSOR-IMG TO dynamicaly call the post featured image when $('.news-box h3 a') text link is hovered upon? Any clues?
The text was updated successfully, but these errors were encountered:
REFERENCE FROM THE ATTRIBUTE ABOVE, INSTEAD OF USING A LINK OF AN IMAGE, HOW CAN I SET THE DATA-CURSOR-IMG TO dynamicaly call the post featured image when $('.news-box h3 a') text link is hovered upon? Any clues?
You need put an url of the featured image on the data-cursor-img, if you're make a custom template, you can do it like this
<?php
// Get the post's featured image URL
$featured_image_url = get_the_post_thumbnail_url(get_the_ID(), 'full');
// Output the HTML element with the data-cursor-img attribute
if ($featured_image_url) {
echo '<div data-cursor-img="' . esc_attr($featured_image_url) . '">';
// Your post content here...
echo '</div>';
}
?>
jQuery(document).ready(function($) {
$('.news-box h3 a')
.attr('data-cursor-img', '/wp-content/uploads/2023/04/soccer_cover.jpg');
});
REFERENCE FROM THE ATTRIBUTE ABOVE, INSTEAD OF USING A LINK OF AN IMAGE, HOW CAN I SET THE DATA-CURSOR-IMG TO dynamicaly call the post featured image when $('.news-box h3 a') text link is hovered upon? Any clues?
The text was updated successfully, but these errors were encountered: