how to make fp an external link
-
Is there any way to make the FP images link to offsite links? I imagine it’s PHP, but still struggling with that.
-
never mind I found the snippet
I am using the snippet but can’t figure out how to make the target”_blank” work with it.
I have tried:38 => ‘http://www.mylink.com” target=”_blank’ which is the only config that doesn’t error the website, but it doesn’t work. If I just add target “_blank” I get an error. Any ideas please.It seems that you cannot use target code on the link, is there some way to make ALL external links view in a new window within this snippet?
@questas_admin
according to @marilena request in the snippet comments, I think you could try to paste this code into your functions.phpID, 'ExternalUrl', true); if( $name ) { ?> <a href="" target="_blank></a>if it works I would suggest to post this implemented snippet here:
Setting custom links for the featured pages in CustomizrHope it helps
https://wordpress.org/support/topic/change-featured-pages-title-and-links?replies=16#post-6291600
questas, I used that solution 1 month ago .. it worked.. I’m wondering.. probably there’s some other filter which may conflict?
OK, after testing without success Giorgio’s suggestion (thank you for trying Giorgio), I moved the original snippet to the bottom of my custom.php file and it now seems to work fine with d4z’s link. That is what I was using earlier without success, hmmm. Anyway I couldn’t find any filters that might have been conflicting. Php is rather finicky however.
Thanks everyone, I truly do appreciate the help.Now I see what was wrong! I was using this snippet to make the FP titles clickable, the titles were not “_blank” where as the image itself is “_blank”.
I disabled that for now. Any way to make that snippet work with target blank?
I’m bit lost in all these links, sorry.
If you are talking about this snippet here:
2) Filters version – 2.a) Customizrthis would be my suggestion:
add_filter('tc_fp_single_display', 'add_title_link', 20, 6); function add_title_link($html, $fp_single_id, $show_img, $fp_img, $featured_page_link, $featured_page_title){ $link = '<a href="'.$featured_page_link.' target="_blank">'.$featured_page_title.'</a>'; return preg_replace('/<h(.*?)>'.$featured_page_title.'(.*?)<\/h(.*?)>/', '<h$1>'.$link.'$2</h$1>',$html); }but of course the same result can be achieved with the js or the customizr-pro version of the same snippet.
Are we both on the same line here with this issue?
@questas_admin
Just tried http://themesandco.com/snippet/setting-custom-links-featured-pages-customizr/ (modded for fpu) + 2) Filters version – 2.b) Customizr
works fine here..
Ah I see, you used the js version.
Yeah didn’t get the target. I update the snippet to make it retrieve the target.Much thanks d4z, that worked perfect.
No problem questas ๐
Consider that that snippet is born ‘because of your request ๐And I thank you for creating it. You are awesome.
The topic ‘how to make fp an external link’ is closed to new replies.
