• Hi all ??

    I have found the code below for the multiple external links of the slide’s picture.

    But I would like also to have multiple external links for the call to action link with new window but I cannot manage it to work. And if I use 2 times the function my_slide_custom_link I get a fatal error.

    thanks in advance.

    add_filter('tc_slide_background' , 'my_slide_custom_link',10,3);
    function my_slide_custom_link( $slide_image , $slide_link , $id) {
    	if ( MY-IMAGE-ID == $id ){
    		return sprintf('<a href="%1$s" rel="nofollow">%2$s</a>', 'MY-CUSTOM-URL', $slide_image);
    	} elseif ( MY-IMAGE-ID == $id ){
    		return sprintf('<a href="%1$s" rel="nofollow">%2$s</a>', 'MY-CUSTOM-URL', $slide_image);
    	} elseif ( MY-IMAGE-ID == $id ){
    		return sprintf('<a href="%1$s" rel="nofollow">%2$s</a>', 'MY-CUSTOM-URL', $slide_image);
    	} elseif ( MY-IMAGE-ID == $id ){
    		return sprintf('<a href="%1$s" rel="nofollow">%2$s</a>', 'MY-CUSTOM-URL', $slide_image);
    	} elseif ( MY-IMAGE-ID == $id ){
    		return sprintf('<a href="%1$s" rel="nofollow">%2$s</a>', 'MY-CUSTOM-URL', $slide_image);
    	} elseif ( MY-IMAGE-ID == $id ){
    		return sprintf('<a href="%1$s" rel="nofollow">%2$s</a>', 'MY-CUSTOM-URL', $slide_image);
    	} elseif ( MY-IMAGE-ID == $id ){
    		return sprintf('<a href="%1$s" rel="nofollow">%2$s</a>', 'MY-CUSTOM-URL', $slide_image);
    	} else{
    		return $slide_image;
    	}
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Does this help?
    https://themesandco.com/snippet/setting-a-custom-external-url-to-a-slide/

    But remember to change the name of the functions if you want to use your code and one of those in the link, you can’t have the same name for more than one function.

    Thread Starter vegas778

    (@vegas778)

    Hi D4Z_c0Nf,

    No, this page does not help for the Multiple External links for the call to action links opening to a new window.

    There is only 1 code for ONE call to action link opening a new window I dont know the code for multiple external links opening a new window.

    Regarding the name of the function I have to change it only in the code I will add or also somewhere else ?

    You have to replicate the same code you use above but this time with the button:

    add_filter('tc_slide_link_url' , 'my_slide_custom_button_link', 10, 2);
    function my_slide_custom_button_link( $slide_link , $image_id ) {
    	if ( MY-IMAGE-ID == $image_id ){
    	    return 'https://www.google.com" target="_blank" rel="nofollow';
    	} elseif ( MY-IMAGE-ID2 == $image_id ){
    	    return 'https://www.yahoo.com" target="_blank" rel="nofollow';
    	} elseif ..
    		.....
    	}else{
    		return $slide_link;
    	}
    }

    this is the basic structure/concept of the snippet you have to use.
    We used a trick to add the target blank and the rel no follow, without using the javascript ( we don’t close the last attribute double quote.)
    Hope this helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple External links slide's picture call to action link’ is closed to new replies.