Home › Forums › WoodMart support forum › adding rel=nofollow
adding rel=nofollow
- This topic has 7 replies, 2 voices, and was last updated 6 years, 11 months ago by Artem Temos.
-
AuthorPosts
-
February 5, 2018 at 12:03 am #37414
wanilaParticipantHello!
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 …February 5, 2018 at 7:20 am #37433
Artem TemosKeymasterHi,
Thank you for reporting us on this issue. We will add nofollow attribute in the next update.
Regards
February 5, 2018 at 9:06 am #37466
wanilaParticipantthank 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?February 5, 2018 at 9:48 am #37468
Artem TemosKeymasterTry 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 }
February 5, 2018 at 10:38 am #37477
wanilaParticipantthanks. 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?
February 5, 2018 at 12:18 pm #37498
Artem TemosKeymasterTry 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 }
February 5, 2018 at 1:40 pm #37534
wanilaParticipantThank 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?February 5, 2018 at 2:06 pm #37545
Artem TemosKeymasterYou don’t need to worry since it doesn’t influence your website speed.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register