Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

Chouby on "[Plugin: Polylang] How to notify users that there are no translation for this post/page/category"

$
0
0

You can send your visitor to a custom error page. You can add something like this in a custom plugin:

add_filter('pll_the_language_link', 'no_translation_link', 10, 2);
function no_translation_link($url, $slug) {
	if ($url === null) {
		if ($slug == 'en')
			$url = get_permalink(x); // replace x by the id of the page you want to link to
		elseif ($slug == 'fr')
			$url = get_permalink(y); // replace y ...
	}
	return $url;
}

I will add a class "no-translation" in v1.0


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>