• Resolved effexdon

    (@effexdon)


    Hello. I am trying to use certain galleries with certain posts, but i don’t want them to display on the Home Page when/where I am showing ALL of the most recent Posts. Is it possible to set the gallery in the “single post” page and call to another variable in the post (maybe using custom fields)? Please let me know if there is a way I can or not.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter effexdon

    (@effexdon)

    I’m very new to PHP, but not to programming so i may be butchering the syntax. This is what I’m trying:

    <?php
    $GalID = get_post_meta($post->ID, "Gallery", true);
    echo $GalID;
    $showgallery = '[gallery=$GalID]';
    $showgallery = apply_filters('the_content', $showgallery );
    echo $showgallery;
    ?>

    Any ideas or help would be great.

    Thread Starter effexdon

    (@effexdon)

    I got it working in case anyone else ever needs this.

    <?php
    $GalID = get_post_meta($post->ID, "Gallery", true);
    $showgallery = "[gallery=$GalID]";
    $showgallery = apply_filters('the_content', $showgallery );
    echo $showgallery;
    ?>

    I replaced single quotes with double quotes around the $showgallery variable and it works great.

    Hi Effex,

    I am trying to insert a NextGen gallery on homepage (which is not a post or a page). What modification in the code do you think I should do. I tried using your code in my template homep.php but it doesn’t work.

    Please help. The link is https://www.sleekmakeup.com/wordpress and the heading is ‘get the look’

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: NextGEN Gallery] Trying to add to Post w/out displaying on Home Page’ is closed to new replies.