Title: Make custom class available everywhere?
Last modified: August 21, 2016

---

# Make custom class available everywhere?

 *  [George88](https://wordpress.org/support/users/george88/)
 * (@george88)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/make-custom-class-available-everywhere/)
 * Hello,
 * I have written a class and saved it in its own file inside my theme folder (using
   the BlankSlate theme). I want to include the class in such a way that it is available
   in every single file for the theme (such as “sidebar.php”, “header.php”, etc),
   but using “require_once()” inside the “index.php” file does not work.
 * How do I do this?
 * Currently I have used the “require_once()” function in “header.php”, but when
   I want to reference a member function inside the “sidebar.php” file I get an 
   error telling me I’m calling a member function of a non-object. In other words
   the class is not available inside the “sidebar.php” file.
 * How can I achieve this?
 * George

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/make-custom-class-available-everywhere/#post-4061058)
 * Put the `require_once()` on your theme’s functions.php file, not on template 
   files.

Viewing 1 replies (of 1 total)

The topic ‘Make custom class available everywhere?’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/make-custom-class-available-everywhere/#post-4061058)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
