Title: [Plugin: Simple Lightbox] Using with custom post types
Last modified: August 20, 2016

---

# [Plugin: Simple Lightbox] Using with custom post types

 *  Resolved [transparencia](https://wordpress.org/support/users/transparencia/)
 * (@transparencia)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/)
 * Hi Archetyped and thank you so much for your offer to the world. 🙂
 * I would like to ask you if it’s possible to display the lightbox on a custom 
   post type?
 * I think it’s probably related to the `function is_enabled()` but I ddon’t know…
 * Any help turning it on for **all types** of posts.
 * [http://wordpress.org/extend/plugins/simple-lightbox/](http://wordpress.org/extend/plugins/simple-lightbox/)

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

 *  Plugin Author [Archetyped](https://wordpress.org/support/users/archetyped/)
 * (@archetyped)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/#post-2366192)
 * SLB doesn’t discriminate between post types. If the “Enable on Posts” option 
   is checked, then SLB will work on any post/custom post type.
 * If this is not working for you, then please provide a link to a page that exhibits
   the issue you’re experiencing and I’ll take a look.
 *  Thread Starter [transparencia](https://wordpress.org/support/users/transparencia/)
 * (@transparencia)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/#post-2366279)
 * Thank you so much for the interest, Archetyped 🙂
 * Here you go:
 * [Test Gallery](http://udevo.net/gallery/test-gallery-2/)
 * This is a custom post type gallery that uses the **regular wordpress gallery 
   shortcode**. The .php function behind this only has this:
 * `echo do_shortcode('[gallery]');`
 *  Plugin Author [Archetyped](https://wordpress.org/support/users/archetyped/)
 * (@archetyped)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/#post-2366296)
 * Does your theme use the required `the_content()` template tag? See [SLB’s installation and usage notes](http://archetyped.com/tools/simple-lightbox/)
   for more information.
 *  Thread Starter [transparencia](https://wordpress.org/support/users/transparencia/)
 * (@transparencia)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/#post-2366302)
 * This is what I’m doing:
 *     ```
       function gpp_gallery_images($size='large') {
   
       global $post_type;
   
         if ( $post_type == 'gallery' )
       	echo do_shortcode('[gallery]');;
   
           // Returns the content.
           return $content;
   
       }
   
       add_filter( 'the_content', 'gpp_gallery_images', 20 );
       ```
   
 * And it doesn’t work… Do you have any suggestions?
 *  Plugin Author [Archetyped](https://wordpress.org/support/users/archetyped/)
 * (@archetyped)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/#post-2366308)
 * Filter functions should not output data themselves, but rather pass modified 
   data (e.g. post content) to be filtered by other functions hooked into the same
   filter. Doing so negates the primary purpose of filters (to allow content to 
   be modified/customized prior to output).
 * You should add the value from the gallery shortcode to `$content` prior to returning
   it in the filter function.
 * Documentation on filters in WP: [http://codex.wordpress.org/Plugin_API#Create_a_Filter_Function](http://codex.wordpress.org/Plugin_API#Create_a_Filter_Function)
 *  Thread Starter [transparencia](https://wordpress.org/support/users/transparencia/)
 * (@transparencia)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/#post-2366311)
 * Of course! Than you so much, Archetyped!!
 * Here’s the code in case if anyone needs it:
 *     ```
       function gpp_gallery_images() {
       	global $post_type;
   
       		if ($post_type == 'gallery')
       		{
       			$content = $content.'[gallery]';
       		}
   
       	return $content;
       }
       add_filter('the_content', 'gpp_gallery_images');
       ```
   
 * PS: Now I just need one last thing to make it perfect…

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

The topic ‘[Plugin: Simple Lightbox] Using with custom post types’ is closed to 
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-lightbox.svg)
 * [Simple Lightbox](https://wordpress.org/plugins/simple-lightbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-lightbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-lightbox/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-lightbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-lightbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-lightbox/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [transparencia](https://wordpress.org/support/users/transparencia/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-using-with-custom-post-types/#post-2366311)
 * Status: resolved