Viewing 5 replies - 1 through 5 (of 5 total)
  • How does 2 lines of code sound?

    $gallery_shortcode = '[gallery id="' . intval( $post->post_parent ); . '"]';
    print apply_filters( 'the_content', $gallery_shortcode );
    Thread Starter stereopoly

    (@stereopoly)

    sounds nice. but i’m not good in php. how do i put it into my image.php? still missin some <?php-stuff, right?

    yep…

    <?php
    $gallery_shortcode = '[gallery id="' . intval( $post->post_parent ); . '"]';
    print apply_filters( 'the_content', $gallery_shortcode );
    ?>

    Thread Starter stereopoly

    (@stereopoly)

    does not work ??

    Sorry, there was a typo in the code I posted above. Try this:

    <?php
    $gallery_shortcode = '[gallery id="' . intval( $post->post_parent ) . '"]';
    print apply_filters( 'the_content', $gallery_shortcode );
    ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to show parent-gallery on image.php’ is closed to new replies.