Title: How add Callback
Last modified: August 22, 2016

---

# How add Callback

 *  Resolved [infohowdy](https://wordpress.org/support/users/infohowdy/)
 * (@infohowdy)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/how-add-callback/)
 * Hello, I need to add a callback function…
    I try to add in file easy-fancybox-
   class.php inside fb_opts but doesn’t work.
 * [https://wordpress.org/plugins/easy-fancybox/](https://wordpress.org/plugins/easy-fancybox/)

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

 *  Thread Starter [infohowdy](https://wordpress.org/support/users/infohowdy/)
 * (@infohowdy)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191297)
 * I need to remove/add a class after close fancybox
 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191347)
 * Hi infohowdy,
 * > I try to add in file easy-fancybox-class.php inside fb_opts but doesn’t work.
 * That would be the best way, yes. What code did you try?
 *  Thread Starter [infohowdy](https://wordpress.org/support/users/infohowdy/)
 * (@infohowdy)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191350)
 * Hello RavanH, after close I need to add/remove class or show something like this:
 *     ```
       afterClose: function(){$('body').append('<div id="thanks" style="position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;">Thanks for watching !</div>');}
       ```
   
 * I try to add the code before closing fb_opts (around line 80)in easy-fancybox-
   class.php
 *     ```
       echo ', \'afterClose\': function(){$(\'body\').append(\'<div id="thanks" style="position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;">Thanks for watching !</div>\');}';
       		echo ' };
       	var easy_fancybox_handler = function(){';
       ```
   
 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191365)
 * Sorry, easy-fancybox-class.php is not the correct file. You need to edit **easy-
   fancybox-settings.php** instead. It holds a large array with all the default 
   options. Find (for example) the Youtube array which starts with:
 *     ```
       'YouTube' => array(
       	'title' => __('YouTube','easy-fancybox'),
       	'input' => 'multiple',
       	'options' => array(
       		'intro' => array (
       			...
       ```
   
 * Now add an extra array key right between that `'options' => array` and the following`'
   intro' => array` like:
 *     ```
       'onClosed' => array (
       	'noquotes' => true,
       	'default' => 'function() { $("body").append("<div id=\"thanks\" style=\"position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;\">Thanks for watching !</div>"); }'
       	),
       ```
   
 * (do not forget that comma at the end there)
 * Notes:
    1. Please be aware that after the next plugin update, your modification
   will be gone! 2. You’ll have to do this for every media type if you want same(
   or similar) messages for all.
 *  Thread Starter [infohowdy](https://wordpress.org/support/users/infohowdy/)
 * (@infohowdy)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191378)
 * Hello, thankyou!
    I tried to add options around line 370 in easy-fancybox-class.
   php but seems doesn’t work This is the code I wrong somethings ?
 *     ```
       'IMG' => array(
       			'title' => __('Images','easy-fancybox'),
       			'input' => 'multiple',
       			'options' => array(
   
       				'intro' => array (
       					'hide' => true,
       					'description' => __('To make images open in an overlay, add their extension to the Autodetect field or use the class "fancybox" for its link. Clear field to switch off all autodetection.','easy-fancybox') . '<br />'
       					),
       	/*my option*/
       					'onClosed' => array (
       	'noquotes' => true,
       	'default' => 'function() { $("body").append("<div id=\"thanks\" style=\"position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;\">Thanks for watching !</div>"); }'
       	),
       	/*end my option*/
       ```
   
 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191381)
 * Do you get any errors? Can you share a link to your site?
 *  Thread Starter [infohowdy](https://wordpress.org/support/users/infohowdy/)
 * (@infohowdy)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191385)
 * Sure ! I thankyou very much !
    This is the link [http://urlgone.com/2d7e05/](http://urlgone.com/2d7e05/)
 * I’m sorry for short url but is a test page (will expire on 2016)
 * this is the code from line 369 to 386
 *     ```
       'IMG' => array(
       			'title' => __('Images','easy-fancybox'),
       			'input' => 'multiple',
       			'options' => array(
       				'intro' => array (
       					'hide' => true,
       					'description' => __('To make images open in an overlay, add their extension to the Autodetect field or use the class "fancybox" for its link. Clear field to switch off all autodetection.','easy-fancybox') . '<br />'
       					),
       					/*my option*/
       					'onClosed' => array (
       	'noquotes' => true,
       	'default' => 'function() { $("body").append("<div id=\"thanks\" style=\"position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;\">Thanks for watching !</div>"); }'
       	),
       	/*end my option*/
       				'tag' => array (
       					'hide' => true,
       					'default' => 'a.fancybox, area.fancybox, li.fancybox a:not(li.nofancybox a)'
       					),
       ```
   
 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191402)
 * Replace the `$("body")` with `jQuery("body")` and it should start working 🙂
 *  Thread Starter [infohowdy](https://wordpress.org/support/users/infohowdy/)
 * (@infohowdy)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191403)
 * Thankyou very much!

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

The topic ‘How add Callback’ is closed to new replies.

 * ![](https://ps.w.org/easy-fancybox/assets/icon-256x256.png?rev=3188201)
 * [Firelight Lightbox](https://wordpress.org/plugins/easy-fancybox/)
 * [Support Threads](https://wordpress.org/support/plugin/easy-fancybox/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-fancybox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-fancybox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-fancybox/reviews/)

## Tags

 * [callback](https://wordpress.org/support/topic-tag/callback/)

 * 9 replies
 * 2 participants
 * Last reply from: [infohowdy](https://wordpress.org/support/users/infohowdy/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/how-add-callback/#post-5191403)
 * Status: resolved