laura-work-in-progress
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Header Social links in new windowha ha this advice is probably even better than the target-blank one, through my research on various questions I’ve seen a loooot of controversy. Anyhow, grateful for your help & good luck! ??
Forum: Fixing WordPress
In reply to: Header Social links in new windowHi @bcworkz ,
That’s great, thanks, works now, and yes – in the process of researching this subject “new window” option was much more strongly encouraged then “target blank” and was reading up on all the Pros and Cons on this. very controversial subject, as it appears ??But thanks for your help, much appreciated!
Have a fab day,
Laura
Forum: Fixing WordPress
In reply to: add target”_blank” to PHP codeI think I’ve located the actual code, I tried to define target “blank here, but no luck. If you’re able to advice, that would be wonderful, thanks
if (!$type) { foreach ($items_array as $item) { $icon = $default_icons[$item['type']]['icon']; $html .= '<a href="' . esc_url($item['url']) . '" target=" '_blank' "><i class="' . esc_attr($icon) . '"></i></a>'; } return $html; } elseif ($type == 'square') { foreach ($items_array as $item) { $icon = $square_icons[$item['type']]['icon']; $html .= '<a href="' . esc_url($item['url']) . '" target=" '_blank'"><i class="' . esc_attr($icon) . '"></i></a>'; } return $html; } elseif ($type == 'with-title') { foreach ($items_array as $item) { $icon = $default_icons[$item['type']]['icon']; $title = $default_icons[$item['type']]['title']; $html .= '<a href="' . esc_url($item['url']) . '" target= " '_blank'"><i class="' . esc_attr($icon) . '"></i><span>' . strip_tags($title) . '</span></a>'; } return $html; }
- This reply was modified 4 years, 9 months ago by laura-work-in-progress.
Forum: Fixing WordPress
In reply to: add target”_blank” to PHP codehi @catacaustic
Thanks for your response, I’ve found the location of each individual social link and wondering if the array could be wrapped into a link itself with target blank?
here’s the code:
if (!function_exists(‘pt_build_social_links’)) {
function pt_build_social_links($type = false, $items = false) {
$html = ”;
$default_icons = array(
‘500px’ => array(
‘icon’ => ‘fab fa-500px’,
‘title’ => esc_html__(‘500px’, ‘unta’),
),
‘amazon’ => array(
‘icon’ => ‘fab fa-amazon’,
‘title’ => esc_html__(‘Amazon’, ‘unta’),
),
‘app-store’ => array(
‘icon’ => ‘fab fa-app-store’,
‘title’ => esc_html__(‘App Store’, ‘unta’),
),
‘behance’ => array(
‘icon’ => ‘fab fa-behance’,
‘title’ => esc_html__(‘Behance’, ‘unta’),
),Forum: Fixing WordPress
In reply to: add target”_blank” to PHP codein this scenario i do need it for my header social links since it takes you to a twitter.com or an instagram.com page. So here the impaction is that it leaves my site regardless. So thanks for the advice it won’t be relevant this time around ??
Forum: Fixing WordPress
In reply to: add target”_blank” to PHP code@otto42 The requirement here is to open social media links in new window, therefore not leaving my website – so in this scenario it is required.
Are there better ways to do it? happy to take on board some advice ??
Forum: Fixing WordPress
In reply to: add target”_blank” to PHP codeThanks @catacaustic,
This is the actual header code, I tried to add this command here but no luck either:
if(pt_get_theme_setting('header_social_links') == 'true' && $social_links = pt_build_social_links()) { $header_social_links_html = '<div class="social-links">'.$social_links.'</div>'; }
Thanks for your time, much appreciated. I’ve been at this for hours (not a pro in coding as you can tell), but no luck
- This reply was modified 4 years, 9 months ago by Marius L. J.. Reason: Fixed code block