Search code examples
wordpressyoothemes

Link image in panel


I have this panel made with yootheme builder. I would like the image to have the link as well as the button. https://www.diningsix.dk/panel-test/

I found this solution on another website but it doesn't seam to work:

    <script>
jQuery(function(){
jQuery('.linkpanel .uk-card > .uk-card-body > .readmore').each( function(){
var readmore = jQuery(this);
var href = jQuery(readmore).attr('href');
var link = '<a href="' + href + '"></a>';
jQuery(readmore).closest('.uk-card').find('.uk-card-media-top, .el-title, .el-content').wrap(link);
});
});
</script>

Solution

  • This seams to work..

    jQuery('body').ready(function(){
        jQuery('.uk-card').each(function(){
            $card = jQuery(this)
            var link = $card.find('.el-link').attr('href')
            if(link){
                $card.find('.el-image').wrap('<a href=' + link + '></a>')
            }
        })
    })