Link from custom field – issue in Chrome on mobile devices
-
I use the below function for cross-linking separate pages from different wordpress instalations (a bilingual site):
The below codes are in mirror on both sites:
in functions.php:
function BilingualLink($post_id, $linktext = "en", $beforelink = "<p id='lang_link'>", $afterlink = "</p>", $defaulturl = "https://www.mydomain.com/", $linktitle = "English", $doecho = false) { $otherlangurl = get_post_meta($post_id, "Alt_Lang_ID", true); if ($otherlangurl != '' && (is_single() || is_page())) { $langlink = $beforelink . '<a href="'. $defaulturl . '' . $otherlangurl . '" title="' . $linktitle . '">' . $linktext . '</a>' . $afterlink; } elseif ((is_category() || is_day() || is_month() || is_year() || is_tag() || is_author()) && !(is_home() || is_front_page() || is_tax() || is_search())) { $langlink = $beforelink . '<a href="'. $defaulturl . 'news/" title="' . $linktitle . '">' . $linktext . '</a>' . $afterlink; } elseif (is_tax()) { $langlink = $beforelink . '<a href="'. $defaulturl . 'mycustomfield" title="' . $linktitle . '">' . $linktext . '</a>' . $afterlink; } else { $langlink = $beforelink . '<a href="' . $defaulturl . '" title="' . $linktitle . '">' . $linktext . '</a>' . $afterlink; } if ($doecho) { echo ($langlink); } else { return $langlink; } }
in header.php:
<?php // Bilingual Link if ( function_exists( 'BilingualLink' ) ) : echo BilingualLink( $post->ID, 'en', '<p id="lang_link">', '</p>'); endif;?>
It works like a charm on PC/MAC, in different browsers, but in Google Chrome on mobile devices (tested on Ipad/Android) the link is not loaded, but only if I check the “Request Desktop Site”. (The site does not have a mobile theme).
Any idea how to solve this issue?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Link from custom field – issue in Chrome on mobile devices’ is closed to new replies.