wc_products_array_orderby_date() WC 3.0.0
Sort by date.
Хуков нет.
Возвращает
Число.
Использование
wc_products_array_orderby_date( $a, $b );
- $a(WC_Product) (обязательный)
- First WC_Product object.
- $b(WC_Product) (обязательный)
- Second WC_Product object.
Список изменений
С версии 3.0.0 | Введена. |
Код wc_products_array_orderby_date() wc products array orderby date WC 4.9.1
function wc_products_array_orderby_date( $a, $b ) {
if ( $a->get_date_created() === $b->get_date_created() ) {
return 0;
}
return ( $a->get_date_created() < $b->get_date_created() ) ? -1 : 1;
}