Function Reference: geodir_load_cpt_text_translation
Summary
Get the cpt texts for translation.
Package
GeoDirectory
Parameters
- $translation_texts
- (array) (required) Array of text strings.
- Default: None
Return Values
- (array)
- Translation texts.
Change Log
Since: 1.5.5
Source File
geodir_load_cpt_text_translation() is located in geodirectory-functions/general_functions.php [Line: 4917]
Source Code
function geodir_load_cpt_text_translation( $translation_texts = array() ) { $gd_post_types = geodir_get_posttypes( 'array' ); if ( ! empty( $gd_post_types ) ) { foreach ( $gd_post_types as $post_type => $cpt_info ) { $labels = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : ''; $description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : ''; $seo = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : ''; if ( ! empty( $labels ) ) { if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) { $translation_texts[] = $labels['name']; } if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) { $translation_texts[] = $labels['singular_name']; } if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) { $translation_texts[] = $labels['add_new']; } if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) { $translation_texts[] = $labels['add_new_item']; } if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) { $translation_texts[] = $labels['edit_item']; } if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) { $translation_texts[] = $labels['new_item']; } if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) { $translation_texts[] = $labels['view_item']; } if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) { $translation_texts[] = $labels['search_items']; } if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) { $translation_texts[] = $labels['not_found']; } if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) { $translation_texts[] = $labels['not_found_in_trash']; } if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) { $translation_texts[] = $labels['label_post_profile']; } if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) { $translation_texts[] = $labels['label_post_info']; } if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) { $translation_texts[] = $labels['label_post_images']; } if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) { $translation_texts[] = $labels['label_post_map']; } if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) { $translation_texts[] = $labels['label_reviews']; } if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) { $translation_texts[] = $labels['label_related_listing']; } } if ( $description != '' && ! in_array( $description, $translation_texts ) ) { $translation_texts[] = normalize_whitespace( $description ); } if ( ! empty( $seo ) ) { if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) { $translation_texts[] = normalize_whitespace( $seo['meta_keyword'] ); } if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) { $translation_texts[] = normalize_whitespace( $seo['meta_description'] ); } } } } $translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts; return $translation_texts; }