Answer the question
In order to leave comments, you need to log in
Display information in the admin panel?
I have a function that calculates the sum of the cost of all products on the site. How can this information be displayed in the admin panel so that the customer can view it, no matter where, just so that the admin panel is displayed somewhere
Answer the question
In order to leave comments, you need to log in
You can add this information not even to the admin panel, but directly to the front on any hook before / after the goods. Just wrap the function in current_user_can( 'manage_options' )
so that this text can be seen by someone who has administrator rights
function goods_value() {
if ( current_user_can( 'manage_options' ) ) {
echo '<p>Стоимость товаров на этой странице: ' . $p . '</p>';
echo '<p>Стоимость товаров в категории: ' . $c . '</p>';
echo '<p>Стоимость всех товаров на сайте: ' . $s . '</p>';
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question