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

2 years 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

Popup

< 1 min read

How to Limit Popup Height

Use this CSS to limit the height of your popups. It also works on containers.

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

Single Post

< 1 min read

Enhance WordPress Buttons

Optimize your WordPress site with these CSS tweaks. Elevate button aesthetics and code block readability for a better user experience

Read more

Troubleshoot

< 1 min read

How to Fix Critical Error when Adding a New Site on WordPress Multisite

If you have ‘Delete Duplicate Posts’ plugin, deadactivate it, and then see if that fixes the problem. Otherwise, try to

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, May 22

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.