Home Forums WoodMart support forum How can I wrap the Wishlist text in another tag

How can I wrap the Wishlist text in another tag

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #535091

    Chingiz
    Participant

    Hello!

    How can I wrap the text “Add to Wish List” and “View Wish List” in the <noindex> tag?

    Attachments:
    You must be logged in to view attached files.
    #535294

    Hung Pham
    Keymaster

    Hi Chingiz,

    Thanks for reaching to us.

    Try to edit the file woodmart/inc/integrations/woocommerce/modules/wishlist/class-ui.php and you can add more tags https://prnt.sc/NXyNvXgbgd93

    Regards,

    #535315

    Chingiz
    Participant

    But it will work until the first update.

    #535450

    Chingiz
    Participant

    Please tell me what can be done. I’m not good at PHP. I’m trying to inherit from the ui class, but I’m not getting anywhere.

    namespace XTS\WC_Wishlist;
    
     if ( ! defined( 'ABSPATH' ) ) {
         exit( 'No direct script access allowed' );
     }
     
    use XTS\Ui;
    
    class New_Ui extends Ui {
    
    	public function add_to_wishlist_btn( $classes = '' ) {
    		woodmart_enqueue_js_script( 'wishlist' );
    
    		if ( woodmart_get_opt( 'wishlist_expanded' ) && 'disable' !== woodmart_get_opt( 'wishlist_show_popup', 'disable' ) && is_user_logged_in() ) {
    			woodmart_enqueue_js_script( 'wishlist-group' );
    		}
    
    		$added        = false;
    		$link_classes = '';
    		$text         = esc_html__( 'Add to wishlist', 'woodmart' );
    		$product_id   = apply_filters( 'wpml_object_id', get_the_ID(), 'product', true, apply_filters( 'wpml_default_language', null ) );
    
    		if ( $this->wishlist && $this->wishlist->get_all() && woodmart_get_opt( 'wishlist_save_button_state', '0' ) ) {
    			$products = $this->wishlist->get_all();
    			foreach ( $products as $product ) {
    				if ( (int) get_the_ID() === (int) $product['product_id'] ) {
    					$added = true;
    				}
    			}
    		}
    
    		if ( $added ) {
    			$link_classes .= ' added';
    			$text          = esc_html__( 'Browse Wishlist', 'woodmart' );
    		}
    
    		$classes .= woodmart_get_old_classes( ' woodmart-wishlist-btn' );
    
    		?>
    			<div class="wd-wishlist-btn <?php echo esc_attr( $classes ); ?>">
    				<a class="<?php echo esc_attr( $link_classes ); ?>" href="<?php echo esc_url( woodmart_get_wishlist_page_url() ); ?>" data-key="<?php echo esc_attr( wp_create_nonce( 'woodmart-wishlist-add' ) ); ?>" data-product-id="<?php echo esc_attr( $product_id ); ?>" rel="nofollow" data-added-text="<?php esc_html_e( 'Browse Wishlist', 'woodmart' ); ?>">
    				<noindex><span><?php echo esc_html( $text ); ?></span></noindex>
    				</a>
    			</div>
    		<?php
    	}
    }
    #535523

    Hung Pham
    Keymaster

    Hi Chingiz,

    Unfortunately, it is possible to change it to a parent theme.

    Actually, noindex should be used for the page, and SEO plugins can handle that. You can read more here https://www.lumar.io/blog/best-practice/noindex-disallow-nofollow/

    Regards,

    #535543

    Chingiz
    Participant

    As far as I know, for Yandex bot, the rel="nofollow" attribute allows you to hide the link, but not the text inside, we need to do this to improve relevance

    https://yandex.ru/support/webmaster/adding-site/indexing-prohibition.html

    #535815

    Hung Pham
    Keymaster

    Hi Chingiz,

    You can add noindex to rel tag and check again https://prnt.sc/u49Ea1hjHRLB

    Regards,

    #536081

    Chingiz
    Participant

    Unfortunately, I still haven’t figured out how I can add the <noindex></noindex> tags herewoodmart/inc/integrations/woocommerce/modules/wishlist/class-ui.php in the parent theme, so that my rules do not disappear the next time the woodmart theme is updated (transferring this class to the child theme does not give a result).

    #536399

    Hung Pham
    Keymaster

    Hi Chingiz,

    Currently, there is no workaround, you need to add it directly to parent theme and backup that file.

    Regards,

    #536465

    Chingiz
    Participant

    I understand you. Thanks

    #536536

    Hung Pham
    Keymaster

    Hi Chingiz,

    Keep us in mind for future questions and concerns, we’re always here to help!

    Regards,

Viewing 11 posts - 1 through 11 (of 11 total)