代码之家  ›  专栏  ›  技术社区  ›  Calvin Seng

对管理逻辑使用get\u current\u屏幕

  •  0
  • Calvin Seng  · 技术社区  · 6 年前

    add_action('current_screen', 'current_screen_callback');
    function current_screen_callback($screen) {
        if( is_object($screen) && $screen->id == 'erp-accounting-expense' ) {
            add_filter( 'gettext', 'erp_filter_gettext', 99, 3 );
        }
    }
    
    function erp_filter_gettext( $translated, $original, $domain ) {
    
        // Use the text string exactly as it is in the translation file
        if ( $translated == "Receive Payment" )  {
            $translated = "Make Payment";
        }
    
        return $translated;
    }
    1 回复  |  直到 6 年前
        1
  •  0
  •   Calvin Seng    6 年前

    add_action('current_screen', 'current_screen_callback');
    function current_screen_callback($screen) {
        if( is_object($screen) && $screen->id == 'accounting_page_erp-accounting-expense' ) {
            add_filter( 'gettext', 'erp_filter_gettext', 99, 3 );
        }
    }
    
    function erp_filter_gettext( $translated, $original, $domain ) {
    
        // Use the text string exactly as it is in the translation file
        if ( $translated == "Receive Payment" )  {
            $translated = "Make Payment";
        }
    
        return $translated;
    }