Title: Template php code for calling class within template
Last modified: August 19, 2016

---

# Template php code for calling class within template

 *  [isimpledesign](https://wordpress.org/support/users/isimpledesign/)
 * (@isimpledesign)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/template-php-code-for-calling-class-within-template/)
 * Hi all
 * I have just developed a wordpress plugin and it is all strutured within a class
   called isimpledesign_feeds_class() so everything works fine and i am calling 
   a function out from the class using.
 * `<?php $isimpledesign = new isimpledesign_feeds_class(); $isimpledesign->isimpledesign_feeds();?
   >`
 * i was just wondering if their is a problem calling it like this because from 
   previous plugins i have always used
 * `<?php if (function_exists('isimpledesign_feeds')) { isimpledesign_feeds(); }?
   >`
 * to call a function in the theme files.
 * Just wondering if anyone has any suggestions???
 * Thanks

Viewing 1 replies (of 1 total)

 *  [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/template-php-code-for-calling-class-within-template/#post-1952632)
 * You could use the PHP function class_exists() to check for a particular class
   existence:
 * [http://php.net/manual/en/function.class-exists.php](http://php.net/manual/en/function.class-exists.php)
 * Or, for a particular method of an existing class you can use the PHP function
   method_exists() to check if a class function (method) exists:
 * [http://www.php.net/manual/en/function.method-exists.php](http://www.php.net/manual/en/function.method-exists.php)
 * So, your code would become something like:
 *     ```
       <?php
         if ( method_exists($isimpledesign, 'isimpledesign_feeds') ) { $isimpledesign->isimpledesign_feeds(); }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Template php code for calling class within template’ is closed to new
replies.

## Tags

 * [class](https://wordpress.org/support/topic-tag/class/)
 * [classes](https://wordpress.org/support/topic-tag/classes/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/template-php-code-for-calling-class-within-template/#post-1952632)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
