Is it possible to use is_admin() for frontend header.php

Question

I have included the theme’s header.php into the WP-ADMIN using iframe but I wanna override certain styles and scripts so I called wp_head() with is_admin()

add_action('wp_head', 'wpse_43672_wp_head');
function wpse_43672_wp_head(){
    if(is_admin()){
        echo "THIS IS HEADER NOT IFRAME";
?>
<style>
    header {    
        position: absolute;
        top: 0;
        z-index: 9999;
        margin-top: 0;
    }
    .navbar-fixed-bottom, .navbar-fixed-top {z-index:9999 !important;}
    .sticky-menu #adminmenuwrap, #adminmenuwrap {position:relative !important;}
    .menu {padding:0 !important;}
    .navbar-wp-panel {margin-top:0 !important;}
    </style>

<?php   
    }}

But this didn’t load anything I wanted as well I edited header.php of the theme also didn’t work

<?php
if(is_admin()){
    echo "hello world!";
}

 wp_head(); ?>

Is there a solution to override an iframe page style or use is_admin() to load certain styles?

0
, , David Buik 2 years 2020-08-28T00:11:37-05:00 0 Answers 53 views 0

Leave an answer

Browse
Browse