コンテンツへスキップ サイドバーへスキップ

Waiting for author

Topic Tags: Compatibility

Overview of the issue

When using AffiliateWP with the AffiliateWP Portal addon and WPML, custom menu links added to the Affiliate Portal display in both languages, but their labels are not translatable. There is no built-in option to translate these custom link labels.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open the …/wp-content/plugins/affiliatewp-affiliate-portal/includes/core/class-menu-links.php file.
  • Look for line 102.
  • Replace:
    // filter only menu links with a page.
    $menu_links = array_filter(
    	$menu_links,
    	function( $menu_link) {
    		return ! empty( $menu_link['id'] );
    	}
    );
            
  • With:
    // 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 );
    	}
    }
            
  • Go to AffiliateWP > Settings > Affiliate Portal and resave your settings.
  • Then go to WPML > String Translation to translate the custom menu link labels.

返信を投稿

他の人に対してトピックに沿った礼儀正しい対応をお願いします。この投稿に関連しない問題についてサポートが必要な場合は、サポートフォーラムを使用してチャットを開始するか、チケットを送信してください。

次のタグが使用できます:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>