Title: add class to this php code?
Last modified: August 20, 2016

---

# add class to this php code?

 *  [Connor Miles](https://wordpress.org/support/users/connor15/)
 * (@connor15)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/add-class-to-this-php-code/)
 *     ```
       add_filter('the_content', 'alc_image_spanner');
   
         function alc_image_spanner($text) {
           $text = preg_replace_callback("#<img(.*?)>#is", create_function('$matches', 'return "<span><img".$matches[1]."></span>";'), $text);
           return $text;
         }
       ```
   
 * **when i add a class like this **
 *     ```
       add_filter('the_content', 'alc_image_spanner');
   
         function alc_image_spanner($text) {
           $text = preg_replace_callback("#<img(.*?)>#is", create_function('$matches', 'return "<span class="gallery"><img".$matches[1]."></span>";'), $text);
           return $text;
         }
       ```
   
 * i get FATAL ERROR : SCREAM: Error suppression ignored for […]
 * any help would be great thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/add-class-to-this-php-code/#post-3293823)
 * try to excape the double quotes of the class;
    example:
 * `<span class=\"gallery\">`
 *  Thread Starter [Connor Miles](https://wordpress.org/support/users/connor15/)
 * (@connor15)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/add-class-to-this-php-code/#post-3293847)
 * ” God Send ” You are the best on the forum by far

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘add class to this php code?’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [Connor Miles](https://wordpress.org/support/users/connor15/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/add-class-to-this-php-code/#post-3293847)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
