David Gero avatar David Gero committed 767eb4e Draft

[m] manual delete and more-text tranlatable

Comments (0)

Files changed (1)

 add_action('save_post', 'gct_save_details');
 function gct_admin_init() {
-	add_meta_box("details", __("Details"), "gct_meta_options", "testimonial", "normal", "low");
+	add_meta_box("details", __("Details",'gc-testimonials'), "gct_meta_options", "testimonial", "normal", "low");
 function gct_meta_options() {  
 		$link = get_permalink($data['fullpage']);
 	if (function_exists('icl_t')) {
-	 	$read_more = icl_t('gc-testimonials', 'more-text', $data['more-text']); 
+		$widget_name = 'more-text-' . $data['widget_id'];
+	 	$read_more = icl_t('gc-testimonials', $widget_name , $data['more-text']); 
 	} else {
 	 	$read_more = $data['more-text']; 
 	function addTranslatableString($name, $value) {
 		if (function_exists('icl_register_string')) {
-				icl_unregister_string('gc-testimonials', $name);
+				// if you would like automation delete string. - But I prefere manual delete.
+				// icl_unregister_string('gc-testimonials', $name);
 				icl_register_string('gc-testimonials', $name, $value);
 		return $value;		
 		$instance['title'] = strip_tags($new_instance['title']);
 		$instance['category'] = strip_tags($new_instance['category']);
 		$instance['limit'] = strip_tags($new_instance['limit']);
-		$instance['more'] = strip_tags($new_instance['more']); 
-		$instance['more-text'] = strip_tags($this->addTranslatableString('more-text', $new_instance['more-text']));
+		$instance['more'] = strip_tags($new_instance['more']);
+		$widget_id = $this->id; 
+		$instance['more-text'] = strip_tags($this->addTranslatableString('more-text-'.$widget_id, $new_instance['more-text']));
 		//$instance['more-text'] = strip_tags($new_instance['more-text']);
 		$instance['fullpage'] = strip_tags($new_instance['fullpage']);
 		$instance['images'] = strip_tags($new_instance['images']);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.