How can I create an array of multiple endpoint for the below custom conditional code?
function is_single_with_endpoint( $endpoint ) {
global $wp_query;
if ( ! isset( $endpoint ) && ! empty( $endpoint ) ) {
return false;
}
if ( array_key_exists( $endpoint, $wp_query->query_vars ) ) {
return true;
} else {
return false;
}
}
This will work is I use
if ( ! is_single_with_endpoint('overview') && ! is_single_with_endpoint('analytics') {
but not as
if ( ! is_single_with_endpoint(array('overview','analytics')){
Aucun commentaire:
Enregistrer un commentaire