• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WooCommerce a2z

WooCommerce a2z

WooCommerce

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WC_Admin_List_Table_Products::product_views() – Change views on the edit product screen.

You appear to be a bot. Output may be restricted

Description

Change views on the edit product screen.

Usage

$array = WC_Admin_List_Table_Products::product_views( $views );

Parameters

$views
( array ) required – Array of views.

Returns

array

Source

File name: woocommerce/includes/admin/list-tables/class-wc-admin-list-table-products.php


Lines:

1 to 18 of 18
  public function product_views( $views ) {
    global $wp_query;

    // Products do not have authors.
    unset( $views['mine'] );

    // Add sorting link.
    if ( current_user_can( 'edit_others_products' ) ) {
      $class            = ( isset( $wp_query->query['orderby'] ) && 'menu_order title' === $wp_query->query['orderby'] ) ? 'current' : '';
      $query_string     = remove_query_arg( array( 'orderby', 'order' ) );
      $query_string     = add_query_arg( 'orderby', rawurlencode( 'menu_order title' ), $query_string );
      $query_string     = add_query_arg( 'order', rawurlencode( 'ASC' ), $query_string );
      $views['byorder'] = '<a href="' . esc_url( $query_string ) . '" class="' . esc_attr( $class ) . '">' . __( 'Sorting', 'woocommerce' ) . '</a>';
    }

    return $views;
  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 10th December 2020

Primary Sidebar

Information

Function name: WC_Admin_List_Table_Products::product_views
Class ref: WC_Admin_List_Table_Products
Plugin ref: WooCommerce
Version: 4.8.0
Sourcefile: includes/admin/list-tables/class-wc-admin-list-table-products.php
File ref: includes/admin/list-tables/class-wc-admin-list-table-products.php
Deprecated?: No
API Letters: A,L,P,T,W

Footer

WooCommerce a2z
WooCommerce a2z
WooCommerce
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites