How can i make an entire row with a photo added to be an entire hyperlink?

How can i make an entire row with a photo added to be an entire hyperlink?
My website is https://contarealserv.ro
As you can see I want to make an row clickable…
Thank you very much

Hi,

Best solution would be to use some JS. Alternatively, you can use Beaver Builder hooks. Simply add an ID to your row. For example: my-row-id

Then add the following to your child theme’s functions.php file.

function row_link_open($row, $groups) {
    if ( 'my-row-id' == $row->settings->id ) {
        echo '<a href="ADD LINK HERE">';
    }
}
add_action('fl_builder_before_render_row', 'row_link_open', 10, 2);

function row_link_close($row, $groups) {
    if ( 'my-row-id' == $row->settings->id ) {
        echo '</a>';
    }
}
add_action('fl_builder_after_render_row', 'row_link_close', 10, 2);

Replace “ADD LINK HERE” in the code above with your URL and save the changes. Any Row with an ID of my-row-id will be wrapped with the link you added to the code. You can also replace my-row-id with any ID you like, but be sure to update the row id in the both code snippets.

Also, please note, some additional CSS maybe required.

1 Like

I appreciate your answer. But unfortunately it’s not working. I added this code in “my custom functions” module and changed my row id and add link here.
Basically what I’m trying to achieve is “despre” row to be clickable and go to “despre page”, “servicii” row go to “servicii page” and so on…
I got this code from a guy, added in global setting / javascript, in beaver builder, and it’s working but not on the mobile version.

jQuery('#aflamaimult')
.css('cursor', 'pointer')
.on('mouseenter', function() {
jQuery(this).css('opacity', '.75')
})
.on('mouseleave', function() {
jQuery(this).css('opacity', '1')
.on('click', function() {
window.location.href = "https://contarealserv/despre";
});
});

The code I provided above definitely works (I tested it before posted). Can you try again and make sure the Row ID you add to the row matches the ID mentioned in the code.

In regard to the code from another user. We can’t provide support for code not provided by us. Try the code I added above again. :slight_smile:


This is what I inserted under functions.php. It’s not working. It says under VSC that it has 6 errors

remove the #'s from the row ids also your VSC is a js file, this code is php.

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.