Home Forums WoodMart support forum adding rel=nofollow

adding rel=nofollow

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #37414

    wanila
    Participant

    Hello!

    in woocommerce archive pages, we can add options for users to select how they want to see the shop page
    for example, 12 product per page or 24 product per page … or other options …
    and thats so cool!
    but why these links doesnt have any nofollow tag?
    this options are so good for human, but not so good for google bots and website seo …

    #37433

    Artem Temos
    Keymaster

    Hi,

    Thank you for reporting us on this issue. We will add nofollow attribute in the next update.

    Regards

    #37466

    wanila
    Participant

    thank you so much.
    can you please tell me which file i must edit and what should i replace to add this function to my website for now?

    #37468

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to do this

    	add_action( 'woocommerce_before_shop_loop', 'woodmart_products_per_page_select', 25 );
    
    	function woodmart_products_per_page_select() {
    		if( ! woodmart_get_opt( 'per_page_links' ) || ( WC()->version >= '3.3.0' && ! wc_get_loop_prop( 'is_paginated' ) || ! woocommerce_products_will_display() ) ) return;
    
    		global $wp_query;
    
    		$per_page_options = woodmart_get_opt('per_page_options');
    
    		$products_per_page_options = (!empty($per_page_options)) ? explode(',', $per_page_options) : array(12,24,36,-1);
    
    		?>
    
    		<div class="woodmart-products-per-page">
    
    			<span class="per-page-title"><?php esc_html_e('Show', 'woodmart'); ?></span>
    
    				<?php
    					foreach( $products_per_page_options as $key => $value ) :
    						?>
    							<a rel="nofollow" href="<?php echo add_query_arg('per_page', $value, woodmart_shop_page_link(true)); ?>" class="per-page-variation<?php echo ($value == woodmart_get_products_per_page()) ? ' current-variation' : ''; ?>">
    								<span><?php
    									$text = '%s';
    									esc_html( printf( $text, $value == -1 ? esc_html__( 'All', 'woodmart' ) : $value ) );
    								?></span>
    							</a>
    							<span class="per-page-border"></span>
    				<?php endforeach; ?>
    		</div>
    		<?php
    	}
    #37477

    wanila
    Participant

    thanks. now the first problem is solved ( just for the next update, please remember the code you send me only works if user set the number of products per page to 12 , 24 , 36 … but for example my products per page number was 6 , 12 , 18 ….. )

    and, the woodmart theme have one more menu that need to be as a nofollow link, and that’s ” products column ” …
    2 column, 3 column, list view and others … any code for this?

    + can i know when the next update will release?

    #37498

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to do this

    add_action( 'woocommerce_before_shop_loop', 'basel_products_view_select', 27 );
    
    	function basel_products_view_select() {
    		if ( WC()->version >= '3.3.0' && ! wc_get_loop_prop( 'is_paginated' ) || ! woocommerce_products_will_display() ) return;
    
    		$shop_view = woodmart_get_opt( 'shop_view' );
    
    		$per_row_selector = woodmart_get_opt( 'per_row_columns_selector' );
    
    		$per_row_options = woodmart_get_opt( 'products_columns_variations' );
    
    		$current_shop_view = woodmart_get_shop_view();
    
    		$current_per_row = woodmart_get_products_columns_per_row();
    
    		$products_per_row_options = ( !empty( $per_row_options ) ) ? array_unique( $per_row_options ) : array(2,3,4);
    		
    		if( $shop_view == 'list' || ( $shop_view == 'grid' && !$per_row_selector ) || ( $shop_view == 'grid' && !$per_row_options )  ) return;
    		
    		?>
    		<div class="woodmart-products-shop-view <?php echo esc_attr( 'products-view-' . $shop_view ); ?>">
    			<?php if ( $shop_view != 'grid'): ?>
    				
    				<a rel="nofollow" href="<?php echo add_query_arg( 'shop_view', 'list', woodmart_shop_page_link( true ) ); ?>" class="shop-view per-row-list <?php echo ( 'list' == $current_shop_view ) ? 'current-variation' : ''; ?>">
    					<?php
    						echo woodmart_get_svg_content( 'list-style' );
    					?>
    				</a>
    				
    			<?php endif ?>
    			<?php if ( $per_row_selector && $per_row_options ): ?>
    
    				<?php foreach ( $products_per_row_options as $key => $value ) : if( $value == 0 ) continue; ?>
    
    					<a rel="nofollow" href="<?php echo add_query_arg( array( 'per_row' => $value, 'shop_view' => 'grid' ) , woodmart_shop_page_link( true ) ); ?>" class="per-row-<?php echo esc_attr( $value ); ?> shop-view <?php echo ( $value == $current_per_row && $current_shop_view != 'list' ) ? 'current-variation' : ''; ?>">
    						<?php
    							echo woodmart_get_svg_content( 'column-' . $value );
    						?>
    					</a>
    
    				<?php endforeach; ?>
    
    			<?php elseif ( $per_row_selector && $per_row_options || $shop_view == 'grid_list' || $shop_view == 'list_grid' ) : ?>
    				
    				<a rel="nofollow" href="<?php echo add_query_arg( 'shop_view', 'grid', woodmart_shop_page_link( true ) ); ?>" class="shop-view <?php echo ( 'grid' == $current_shop_view ) ? 'current-variation' : ''; ?>">
    					<?php
    						echo woodmart_get_svg_content( 'column-3' );
    					?>
    				</a>
    				
    			<?php endif ?>
    		</div>
    		<?php
    	}
    #37534

    wanila
    Participant

    Thank you so much. both codes works great!
    just im a little worry about my website performance with lots of code in function.php file. is it going to affect my website speed?

    #37545

    Artem Temos
    Keymaster

    You don’t need to worry since it doesn’t influence your website speed.

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