As a test in the first conditional statement replace your //php comment
in the else {}
portion of your conditional with an actual echo
statement to see whether the conditional is actually working properly,
<?php
if( is_page( 39 ) ) {
// make your stuff here
echo do_shortcode('[nggallery id=1]');
} else {
echo 'It works!';
}
?>
Go to any of your sub-pages other than 39 of course, and you should see It works! print to screen which then suggests the problem lay more firmly with the plugin.
We need to ensure your conditional is validating properly first..
UPDATE
Seems you have a duplicate question posted here on August 21st which I stumbled across and so to your website and I can see the issue now.
The page id 39 corresponds to this URL,
http://www.yourdomain.com/rebecca-h/
…when navigating to that page you can see the gallery is working perfectly.
However when you are on your gallery page, i.e.,
http://www.yourdomain.com/gallery/
And you use any of the links within your code block,
<a href="index.php?page_id=39">REBECCA HAEHNLE</a>
<a href="index.php?page_id=41">CHRIS KELLER</a>
<a href="index.php?page_id=43">BILLY MALLOY</a>
...shortened for brevity
The URL in which your browser tries to retrieve is,
http://www.yourdomain.com/gallery/index.php?page_id=39
Which for all purposes is incorrect. In fact you’ll notice that you can see the It works! statement echo out to the screen when trying to view Rebecca Haehnle’s gallery which means that the conditional statement, although working, is validating as false instead of true.
Thus we are certainly not on the sub-page like you thought.
Instead, change your links to the following format,
<a href="<?php echo bloginfo('url'); ?>/index.php?page_id=39">REBECCA HAEHNLE</a>
etc...
This will print the top level domain name as your URL http://www.yourdomain.com
before /index.php?page_id=XX
giving you a proper URL.
Alternatively you can use the permalink/slug instead of the ugly index.php?page_id=XX
business like so,
<a href="<?php echo bloginfo('url'); ?>/rebecca-h/">REBECCA HAEHNLE</a>
etc...