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

Video

< 1 min read

Elementor Custom Video Lightbox CSS

Add this code on Appearance Customize > Additional CSS :

Read more

Header

< 1 min read

Header Padding: Conditional HTML

If you want to have conditional padding for your header, give your header the CSS class .mainheader and add an

Read more

PHP

< 1 min read

Maximize PHP Settings Manually on Plesk

Go to ‘File Manager’, edit .htaccess, and add this code after # END WordPress

Read more

Text Widget

2 min read

Perfecting WordPress Text Content Formatting

If you want to have slightly better but very satisfying content formatting for those who understand content formatting, use the

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, October 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.