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

Carlos on "[Plugin: Polylang] Non-existent link"

$
0
0

Hi again!

I have a problem which is similar to what I posted here: http://wordpress.org/support/topic/monthly-archives-2

The thing now is that I found a '<link' with the same links as in the archives ( non-existent links ). I explored the code and I found the function which is generating it:

// meta in the html head section
	function wp_head() {
		// outputs references to translated pages (if exists) in the html head section
		foreach ($this->get_languages_list() as $language) {
			if ($language->slug != $this->curlang->slug && $url = $this->get_translation_url($language))
				printf("<link hreflang='%s' href='%s' rel='alternate' />\n", esc_attr($language->slug), esc_url($url));
		}
	}

Following the example of the other case, I modified it to be:

// meta in the html head section
	function wp_head() {
		// outputs references to translated pages (if exists) in the html head section
		foreach ($this->get_languages_list() as $language) {
			if ($language->slug != $this->curlang->slug && $url = $this->get_translation_url($language))
				$url = apply_filters('pll_the_language_link', $url, $language->slug, $language->description);

				if( !empty( $url ) )
					printf("<link hreflang='%s' href='%s' rel='alternate' />\n", esc_attr($language->slug), esc_url($url));
		}
	}

It seems to be working, but I just wanted to make sure by checking with you.

Please, can you confirm it?

Thank you!!

http://wordpress.org/extend/plugins/polylang/


Viewing all articles
Browse latest Browse all 11471

Trending Articles



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