WC_Admin_Dashboard::status_widget() public WC 1.0
Show status widget.
{} Это метод класса: WC_Admin_Dashboard{}
Хуки из метода
Возвращает
Null. Ничего.
Использование
$WC_Admin_Dashboard = new WC_Admin_Dashboard(); $WC_Admin_Dashboard->status_widget();
Код WC_Admin_Dashboard::status_widget() WC Admin Dashboard::status widget WC 5.0.0
public function status_widget() {
include_once dirname( __FILE__ ) . '/reports/class-wc-admin-report.php';
$reports = new WC_Admin_Report();
echo '<ul class="wc_status_list">';
if ( current_user_can( 'view_woocommerce_reports' ) ) {
$report_data = $this->get_sales_report_data();
if ( $report_data ) {
?>
<li class="sales-this-month">
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-reports&tab=orders&range=month' ) ); ?>">
<?php echo $reports->sales_sparkline( '', max( 7, gmdate( 'd', current_time( 'timestamp' ) ) ) ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
<?php
printf(
/* translators: %s: net sales */
esc_html__( '%s net sales this month', 'woocommerce' ),
'<strong>' . wc_price( $report_data->net_sales ) . '</strong>'
); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
?>
</a>
</li>
<?php
}
$top_seller = $this->get_top_seller();
if ( $top_seller && $top_seller->qty ) {
?>
<li class="best-seller-this-month">
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-reports&tab=orders&report=sales_by_product&range=month&product_ids=' . $top_seller->product_id ) ); ?>">
<?php echo $reports->sales_sparkline( $top_seller->product_id, max( 7, gmdate( 'd', current_time( 'timestamp' ) ) ), 'count' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
<?php
printf(
/* translators: 1: top seller product title 2: top seller quantity */
esc_html__( '%1$s top seller this month (sold %2$d)', 'woocommerce' ),
'<strong>' . get_the_title( $top_seller->product_id ) . '</strong>',
$top_seller->qty
); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
?>
</a>
</li>
<?php
}
}
$this->status_widget_order_rows();
$this->status_widget_stock_rows();
do_action( 'woocommerce_after_dashboard_status_widget', $reports );
echo '</ul>';
}