我創建了if語句來檢查用戶顯示名稱字母是以a,b或c開頭的。問題是,它不僅顯示這些用戶,還會顯示所有用戶。我的if語句有什麼問題?我可以做一些不同的事嗎?檢查當前用戶是否以特定字母開頭
<?php
$args = array(
'exclude' => array(1),
'order' => 'ASC',
);
$user_query = new WP_User_Query(array($args)); ?>
<?php if (! empty($user_query->results)) {
foreach ($user_query->results as $user) { ?>
<?php
$args = array(
'size' => 300,
);
$img_url = get_avatar_url($user->user_email, $args)
?>
<?php
$user_display_name = $user->display_name;
if (strtolower($user_display_name[0]) == "a" || "b" || "c" ) {
?>
<a href="<?php echo 'http://' . $user->user_login . '.domain.com' . '"'; ?>">
<div class="user" style="background-image:url(<?php echo $img_url; ?>);">
<div class="user-avatar">
<img alt="<?php echo $user->display_name; ?>" class="avatar avatar-90 photo avatar-custom" height="90" src="<?php echo $img_url; ?>">
</div>
<div class="user-info">
<h3 class="user-title"><?php echo $user->display_name; ?></h3>
<p class="user-url">
<a href="<?php echo 'http://' . $user->user_login . '.domain.com' . '">'; ?> <?php echo $user->user_login . '.domain.com'; ?></a>
</p>
</div>
</div>
</a>
<?php } ?>
<?php } ?>
<?php } else {
echo 'No users found.';
}
?>