How to Make Post Widget’s White Space Clickable (+Popup)

12 months ago

2 min read

Posted by:

Focus

Subscribe to newsletter

By subscribing you agree to with our Privacy Policy.

Share

Go to Dashboard > Elementor > Custom Code. And then add this code to make the whole space/box/card of the post widget to be clickable.

Note: It does not work on new posts that has been generated by ‘Load More’ or ‘Infinity Scroll’ pagination.

IMPORTANT

You have to set the post CSS Classes to post. But if you forgot and it works just fine, then it’s fine.


CODE

<script>
document.addEventListener('DOMContentLoaded', function() {
jQuery(function($){
$('.post').find('.elementor-post').each(function(){
let link = $(this).find('a').attr('href');
$(this).wrapAll( document.createElement( 'a' ) );
$(this).closest('a').attr('href', link);
});
});
});
</script>

POPUP

If you want the whole box to be clickable on popup as well, add this to Elementor Custom Code as well.

<script>
jQuery( document ).on( 'elementor/popup/show' , function () {
	jQuery(function($){
$('.post').find('.elementor-post').each(function(){
let link = $(this).find('a').attr('href');
$(this).wrapAll( document.createElement( 'a' ) );
$(this).closest('a').attr('href', link);
});
});
});
</script>

BUG

If there is a bug when you set the featured image on the top, put it on the left or right of the title.

Read more

Global

2 min read

Disabling the Device’s Default ‘Dark Mode’ in WordPress

If you are trying to convert your WordPress website to APK / AAB, you may need to disable the device’s

Read more

Header

< 1 min read

Change Color of Header and Show-Hide Elements On Scroll

Useful for transparent headers. IMPORTANT Under ‘Motion Effect’ settings, below ‘Offset’, you must set the ‘Effects Offset’ into ‘1’ or

Read more

PWA

4 min read

How to Publish an App with PWA for WP

Note: On PWA for WP, the icon logo and splash screen are swapped. Please test the .apk before publishing. Also,

Read more

Troubleshoot

< 1 min read

How to Fix Favicon Not Showing on WordPress Multisite

In some cases, sub-sites on multisite is not showing the favicon. To assign favicon for each site on WordPress multisite,

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, October 18

Hi, there 👋

How can I help you?

Start Chat with:

We use cookie to improve your experience on our site. By using our site you consent cookies.