Title: Using functions and PHP object initialisations in widgets
Last modified: August 21, 2016

---

# Using functions and PHP object initialisations in widgets

 *  [Merlyn Cooper](https://wordpress.org/support/users/merlyn-cooper/)
 * (@merlyn-cooper)
 * [13 years ago](https://wordpress.org/support/topic/using-functions-and-php-object-initialisations-in-widgets/)
 * I have been working on trying to make a widget that has dynamically printed checkboxes
   in the front end and controls in the admin section.
 * The problem I’ve had with both of these is that as soon as I use PHP functions
   to initialise an object of a class in another file in order to use that object’s
   functions the html execution ceases, I get either the “white screen of death”
   or I get all the html executed up until that point.
 * Can a class that extends WP_Widget not use PHP in this way?
 * What could I do instead? (will provide code later, catching a bus).

The topic ‘Using functions and PHP object initialisations in widgets’ is closed 
to new replies.

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [oop](https://wordpress.org/support/topic-tag/oop/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)
 * [wp_widget](https://wordpress.org/support/topic-tag/wp_widget/)

 * 0 replies
 * 1 participant
 * Last reply from: [Merlyn Cooper](https://wordpress.org/support/users/merlyn-cooper/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/using-functions-and-php-object-initialisations-in-widgets/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
