• I am trying to call a function which is defined in functions.php. But I can’t figure out why this error is coming.

    Let me tell you in detail what I am trying to accomplish: there are two header files?—?client and admin. The client header will be accessed when the user enters into a page through index.php, but admin header will be accessed after an admin successfuly logged in.

    In the functions.php this is the function I have defined:

    function get_my_header(){
      if(is_home()){
        get_header('client');
      }
      elseif(is_page('dashboard')){
        get_header('own');
      }
    }

    from index.php get_my_header() is called with no error but when I try to access the same function from the admin page I am getting this error:
    Fatal error: Call to undefined function get_my_header()
    The page where this error is coming has only this one line:

    <?php get_my_header(); ?>

    All files resides in one folder.

    Please help ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Depending on what you are ultimately trying to do, personally this is something I would use a plugin for – there are a lot of plugins that will help you do things that only an admin can see, modify the admin bar etc.

    Thread Starter Suneet

    (@suneetpant)

    No i am not using any kind of plugin rather building a theme on my own. Pls help if you have any solution

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error: Call to undefined function’ is closed to new replies.