ddw_wcde_do_string_swaps_product_image

Admin string swap for "Product Image" strings (instead of "Featured Image").

Description

ddw_wcde_do_string_swaps_product_image(); 

Usage

  1. if ( !function_exists( 'ddw_wcde_do_string_swaps_product_image' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-german-de_de/includes/wcde-string-swaps.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ddw_wcde_do_string_swaps_product_image(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wcde-string-swaps.php  
  1. function ddw_wcde_do_string_swaps_product_image() { 
  2.  
  3. /** Bail early if option is not set */ 
  4. if ( 'no' === get_option( 'wcde_load_admin_string_swaps' ) ) { 
  5.  
  6. return; 
  7.  
  8. } // end if 
  9.  
  10. /** 
  11. * Helper filter, allows for custom disabling of string swaps. 
  12. * Usage: add_filter( 'wcde_filter_do_string_swaps', '__return_false' ); 
  13. */ 
  14. $wcde_do_string_swaps = (bool) apply_filters( 'wcde_filter_do_string_swaps', '__return_true' ); 
  15.  
  16. /** 
  17. * Bail early if our helper filter returns false, if we are not in German 
  18. * context within WPML (premium plugin), or, if no German-based locale is 
  19. * to be found for 'WPLANG'. 
  20. * NOTE: This is very important for multilingual sites and/or Multisite 
  21. * installs. 
  22. */ 
  23. if ( ! $wcde_do_string_swaps || ! wcde_is_german() 
  24. ) { 
  25.  
  26. return; 
  27.  
  28. } // end if 
  29.  
  30. /** Set up our array of planned string swap keys/ strings */ 
  31. $wcde_labels = array( 
  32.  
  33. /** Featured image string */ 
  34. 'featured_image_string' => array( 
  35. 'option_key' => 'product_image_string',  
  36. 'strings' => array( 'Featured Image' ),  
  37. 'translation' => 'Produktbild',  
  38. ),  
  39.  
  40. /** Remove featured image string */ 
  41. 'remove_featured_image_string' => array( 
  42. 'option_key' => 'remove_product_image_string',  
  43. 'strings' => array( 'Remove featured image' ),  
  44. 'translation' => 'Produktbild entfernen',  
  45. ),  
  46.  
  47. /** Set featured image string */ 
  48. 'set_featured_image_string' => array( 
  49. 'option_key' => 'set_product_image_string',  
  50. 'strings' => array( 'Set Featured Image', 'Set featured image' ),  
  51. 'translation' => 'Produktbild festlegen',  
  52.  
  53. ); // end of array 
  54.  
  55. /** Apply our string swapper for each string or our array */ 
  56. foreach ( $wcde_labels as $wcde_label => $label_id ) { 
  57.  
  58. /** Actually load the various new label strings for display */ 
  59. $label_id[ 'option_key' ],  
  60. (array) $label_id[ 'strings' ],  
  61. $label_id[ 'translation' ],  
  62. 'default' 
  63. ); 
  64.  
  65. } // end foreach 
  66.  
  67. } // end of function ddw_wcde_do_string_swaps_product_image