37 lines
696 B
PHP
37 lines
696 B
PHP
<?php
|
|
|
|
/*
|
|
* it means someone outside wp is accessing the file, in this case kill it.
|
|
*/
|
|
if (!defined('ABSPATH')) {
|
|
die('You can not access this file!');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* hide admin bar if access a front page and is not an admin
|
|
*/
|
|
function hide_admin_bar_CIPF() {
|
|
PLGNTLS_class::debug_infos();
|
|
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
|
|
|
$slug = get_post_field( 'post_name', get_post() );
|
|
error_log("slug");
|
|
error_log($slug);
|
|
// error_log("request");
|
|
// error_log(json_encode($_REQUEST));
|
|
// error_log("server");
|
|
// error_log(json_encode($_SERVER));
|
|
|
|
if (!current_user_can($role_admin) && !is_admin()) {
|
|
show_admin_bar(false);
|
|
}
|
|
}
|
|
add_action('after_setup_theme', 'hide_admin_bar_CIPF');
|
|
|
|
|
|
?>
|