Function Reference: geodir_wpml_post_type_archive_link

Summary

This function has not been documented yet.

Filters

‘wpml_translate_single_string’ [Line: 1219]

Source File

geodir_wpml_post_type_archive_link() is located in geodirectory-functions/general_functions.php [Line: 1207]

Source Code

function geodir_wpml_post_type_archive_link($link, $post_type){
	if (geodir_is_wpml()) {
		$post_types   = get_option( 'geodir_post_types' );
		
		if ( isset( $post_types[ $post_type ] ) ) {
			$slug = $post_types[ $post_type ]['rewrite']['slug'];

			// Alter the CPT slug if WPML is set to do so
			if ( geodir_wpml_is_post_type_translated( $post_type ) ) {
				if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {

					$org_slug = $slug;
					$slug     = apply_filters( 'wpml_translate_single_string',
						$slug,
						'WordPress',
						'URL slug: ' . $slug,
						$language_code );
                    
					if ( ! $slug ) {
						$slug = $org_slug;
					} else {
						$link = str_replace( $org_slug, $slug, $link );
					}
				}
			}
		}
	}

	return $link;
}