New Landing How can we help? Themeforest Theme Support Dante Image Banner as a link

Viewing 2 posts - 1 through 2 (of 2 total)
  • Posted in: Dante
  • #46329
    jacek
    Member
    Post count: 2

    Hi!

    Is it possible to have an image banner as a link? There is no link option in image banners parameters but maybe it is some way possible?

    As far as I see, I can make whole image banner shortcode into a link via visual builder but then only a text visible on the banner itself works as a link, not the whole image – and I really need to use whole image as a clickable link.

    Anyone?

    Many thanks in advance! 🙂

    #47056
    Melanie – SUPPORT
    Member
    Post count: 11032

    Hm, we will have to rewrite the shortcode.

    In shortcodes.php find

    /* IMAGE BANNER SHORTCODE
    	================================================== */
    	
    	function sf_imagebanner($atts, $content = null) {
    		extract(shortcode_atts(array(
    			"image"			=> "",
    			"animation" 	=> "fade-in",
    			"contentpos"	=> "center",
    			"textalign"	=> "center",
    			"extraclass"	=> ""
    		), $atts));
    		
    		$image_banner = "";
    		
    		$image_banner .= '<div class="sf-image-banner '.$extraclass.'">';	
    		
    		$image_banner .= '<div class="image-banner-content sf-animation content-'.$contentpos.' text-'.$textalign.'" data-animation="'.$animation.'" data-delay="200">';	
    		$image_banner .= do_shortcode($content);
    		$image_banner .= '</div>';
    		
    		$image_banner .= '<img src="'.$image.'" alt="" />';
    		
    		$image_banner .= '</div>';	
    		
    		global $sf_has_imagebanner;
    		$sf_has_imagebanner = true;
    			
    		return $image_banner;
    		
    	}
    	add_shortcode('sf_imagebanner', 'sf_imagebanner');

    and change it to

    /* IMAGE BANNER SHORTCODE
    	================================================== */
    	
    	function sf_imagebanner($atts, $content = null) {
    		extract(shortcode_atts(array(
    			"image"			=> "",
    			"animation" 	=> "fade-in",
    			"contentpos"	=> "center",
    			"textalign"	=> "center",
    			"extraclass"	=> ""
    		), $atts));
    		
    		$image_banner = "";
    		
    		$image_banner .= '<div class="sf-image-banner '.$extraclass.'">';	
    		
    		$image_banner .= '<div class="image-banner-content sf-animation content-'.$contentpos.' text-'.$textalign.'" data-animation="'.$animation.'" data-delay="200">';	
    		$image_banner .= do_shortcode($content);
    		$image_banner .= '</div>';
    		
    		$image_banner .= '<a href="'.$link.'"><img src="'.$image.'" alt="" /></a>';
    		
    		$image_banner .= '</div>';	
    		
    		global $sf_has_imagebanner;
    		$sf_has_imagebanner = true;
    			
    		return $image_banner;
    		
    	}
    	add_shortcode('sf_imagebanner', 'sf_imagebanner');

    This should allow you to use the attribute link=”http://yourlink.com&#8221; in your shortcode if the swift page builder is switched off (!)

    Let me know if that worked please!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register