如果$ws_user_status
是培训师或管理员,我想显示整个代码,但是在此我想在另外两个if语句上分开代码...
如果$ws_total_sales > 0
显示信息消息,否则($ws_total_sales == 0
)显示包含所有内容项的表
但是我出了点问题...桌子一直可见...
<?php
$ws_user_status = 'administrator';
$ws_total_sales = 5;
?>
<?php if ($ws_user_status == 'trainer' || $ws_user_status == 'administrator') : ?>
<?php if ($ws_total_sales > 0) : ?>
<div class="woocommerce-info">
<?php _e( 'You do not have any items to sell.', 'woocommerce' ); ?>
</div>
<?php else : ?>
<div>
<div class="alert alert-info">
<?php _e( 'Your sales.', 'woocommerce' ); ?>
</div>
<table class="table table-hover">
<thead>
<tr>
<th>Item</th>
<th>Total sale</th>
<th>Your profit</th>
</tr>
</thead>
<tbody>
<tr>
<td>Item 1 name</td>
<td>100</td>
<td>75000</td>
</tr>
<tr>
<td>Item 2 name</td>
<td>100</td>
<td>60000</td>
</tr>
<tr>
</tbody>
</table>
</div>
<?php endif; ?>
<?php endif; ?>