WPML
ステータス
開発者により解決済み
解決されたバージョン
2.30.3.
関連するプラグイン/テーマ
AffiliateWP
トピックタグ
Compatibility

問題の概要

AffiliateWPAffiliateWP PortalアドオンおよびWPMLと併用する場合、Affiliate Portalに追加されたカスタムメニューリンクは両方の言語で表示されますが、そのラベルは翻訳不可です。これらのカスタムリンクのラベルを翻訳するための組み込みオプションはありません。

回避策

先に進む前に、必ずサイトの完全なバックアップを取得してください。


  • …/wp-content/plugins/affiliatewp-affiliate-portal/includes/core/class-menu-links.phpファイルを開きます。

  • 102行目を見つけます。

  • 変更前:
    // filter only menu links with a page.
    $menu_links = array_filter(
    	$menu_links,
    	function( $menu_link) {
    		return ! empty( $menu_link['id'] );
    	}
    );
            


  • 変更後:
    // filter only menu links with a page.
    $menu_links = array_filter(
    	$menu_links,
    	function( $menu_link) {
    		return ! empty( $menu_link['id'] );
    	}
    );
    // WPML Workaround for compsupp-8049 - Register menu links labels with WPML
    foreach ( $menu_links as $index => &$link ) {
    	if ( ! empty( $link['label'] ) ) {
    		do_action( 'wpml_register_single_string', 'affiliatewp-portal-menu', 'portal_menu_link_label_' . $index, $link['label'] );
    		$link['label'] = apply_filters( 'wpml_translate_single_string', $link['label'], 'affiliatewp-portal-menu', 'portal_menu_link_label_' . $index );
    	}
    }
            


  • AffiliateWP > 設定 > Affiliate Portalに移動し、設定を再保存します。

  • その後、WPML > 文字列翻訳に移動し、カスタムメニューリンクラベルを翻訳します。

すべての既知の問題 →