title: Can I create own PHP class in wordpress theme function?
body: <p>I have created a bunch of functions for my wordpress theme.
  I am thinking to put all function inside a class. So that I can call it using:</p>
  
  <pre><code>&lt;?php $foo-&gt;function() ;?&gt;
  </code></pre>
  
  <p>I want to know if I put my functions inside php class then will it cause any problem???
  Please note I am using WordPress function inside my functions.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>class foo{
      function js($files){
          $css    =   array($files);
          foreach($css as $style){
              wp_enqueue_script($style, get_template_directory_uri() . '/js/'.$style, array(), '', true );
          }
  
      }
  }
  $foo = new foo();
  </code></pre>
  
  <p>It works well when I call it directly:</p>
  
  <p>$foo->js('bootstrap-transition.js,bootstrap-modal.js,bootstrap-dropdown.js');</p>
  
  <p>but when i call it insde another function like this:</p>
  
  <pre><code>function assets(){
      $foo-&gt;js('bootstrap-transition.js,bootstrap-modal.js,bootstrap-dropdown.js');
  }
  </code></pre>
  
  <p>then it shows <code>Call to a member function on a non-object</code> error</p>