Title: [Plugin: NextGEN Gallery]can I php include= this plugin?
Last modified: August 19, 2016

---

# [Plugin: NextGEN Gallery]can I php include= this plugin?

 *  [facecjf](https://wordpress.org/support/users/facecjf/)
 * (@facecjf)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallerycan-i-php-include-this-plugin/)
 * I was wondering how to code the gallery on my home page within a div tag. instead
   of having it visible only in a post. I have tried the following with no luck..
 *     ```
       <div id="featured">
          <?php include (ABSPATH . '/wp-content/plugins/nextgen-gallery/nggallery.php'); ?>
       </div>
       ```
   
 * Is it possible, and if so how would I do it?
 * Great plugin by the way.
 * Thanks
    Chris

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

 *  [churchthemer](https://wordpress.org/support/users/churchthemer/)
 * (@churchthemer)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallerycan-i-php-include-this-plugin/#post-881090)
 * If you are asking how to include NextGen galleries in template files (such as
   your index.php file) instead of in posts or pages you can use this method:
 *     ```
       <?php
       $showalbum = '[album=AlbumName,compact]';
       $showalbum = apply_filters('the_content', $showalbum );
       echo $showalbum;
       ?>
       ```
   
 * The above method defines a variable which stores the nextgen gallery shortcode.
   You need to change AlbumName to the name of the Album you want to display. The
   variable, containing the shortcode, is then passed through the content filter
   which will render out the gallery to your template file when the page is loaded.
 * Hope that helps.
 *  [khalidslife](https://wordpress.org/support/users/khalidslife/)
 * (@khalidslife)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallerycan-i-php-include-this-plugin/#post-881099)
 * what about the widget plugin? I have it installed on my sidebar using the widget
   editor but I want to place it on the index.php file to call the most recent photos
   from all albums.
 * Also, any idea how you can increase the number of photos the widget shows…it 
   is currently set to a maximum of 9.
 * Thanks.
 *  Thread Starter [facecjf](https://wordpress.org/support/users/facecjf/)
 * (@facecjf)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallerycan-i-php-include-this-plugin/#post-881193)
 * churchthemer,
 * Thank you! That worked. You have to change `'[album=AlbumName,compact]';` to `[
   gallery=ID]` or `[slideshow=ID]` where the ID is the ID of which ever gallery
   you want to display.
 * Thanks again.
 *  [churchthemer](https://wordpress.org/support/users/churchthemer/)
 * (@churchthemer)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallerycan-i-php-include-this-plugin/#post-881196)
 * Glad it worked. I’d only done the filter with albums before, glad to know it 
   works on the other shortcodes as well.

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

The topic ‘[Plugin: NextGEN Gallery]can I php include= this plugin?’ is closed to
new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [churchthemer](https://wordpress.org/support/users/churchthemer/)
 * Last activity: [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallerycan-i-php-include-this-plugin/#post-881196)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
