Support » Fixing WordPress » Custom Fields and Child Pages

  • Mark


    I currently am using the Custom Fields and NextGen Gallery. I have the below snippet of code that pulls in the Gallery Number IF ONE EXISTS but for whatever reason it’s not working for Child pages if a Gallery doesn’t exist. Any ideas?

    <?php If ( $gallery = get_post_meta($post->ID, 'gallery', true)) {
        $gal = $gallery;
        $gal = apply_filters('the_content', '<div id="maintop">' .'[nggallery id=' .$gal.']</div>' );
        echo $gal;
    } else {
        echo "";

    It’s working out awesome for the Parent Pages and those that actually have a gallery assigned to it, but not for Child pages that DON”T have a gallery.

    What am I doing wrong??

  • The topic ‘Custom Fields and Child Pages’ is closed to new replies.