简体   繁体   English

Elseif声明不适用于WordPress功能

[英]Elseif statement to not working for wordpress function

I'm trying to dequeue scripts and styles for logged out users, but allowing the same scripts/styles to appear for two login pages that use those assets. 我正在尝试使已注销用户的脚本和样式出队,但允许对于使用这些资产的两个登录页面显示相同的脚本/样式。

I currently have: 我目前有:

// SCRIPT AND STYLE DENQUEUE
// https://gist.github.com/DevinWalker/7621777
add_action( 'wp_enqueue_scripts', 'dequeue_styles_scripts', 9999 );
add_action( 'wp_head', 'dequeue_styles_scripts', 9999 );

function dequeue_styles_scripts() {

    if (  ! is_user_logged_in() ) { // REMOVING SCRIPTS NOT NEEDED FOR LOGGED OUT USERS

        //UM BASE STYLES AND SCRIPTS
        wp_dequeue_style( 'um_modal' );
        wp_dequeue_style( 'um_styles' );

        wp_dequeue_script( 'um_scripts' );
        wp_dequeue_script( 'um_members' );

    } elseif ( is_page ( array( 4425, 16771 ) ) {

        return;

    }
}

The logged out user conditional works, but the elseif statement isn't working. 已注销的用户条件条件有效,但是elseif语句不起作用。 Not sure why. 不知道为什么。 Thanks for any insight! 感谢您的见解!

You have a closing parentheses missing in the elseif condition. 您在elseif条件中缺少右括号。

elseif ( is_page ( array( 4425, 16771 ) )) {

        return;

    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM