Pular para o conteúdo Pular para a barra lateral

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.

Deixe uma resposta

Por favor mantenha-se no assunto e seja respeitoso com os outros. Se precisar de ajuda com problemas não relacionados a este post, use nosso Fórum de Suporte para iniciar um chat ou enviar um ticket.

Você pode usar estas tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>