Forums

[resolved] Define Next Gen Gallery quick tag content from custom field (2 posts)

  1. mariostella
    Member
    Posted 3 years ago #

    I got this code to call the Next Gen Gallery quick tag from wherever in the code even if not set in the post page:

    <?php
    $gal = '[gallery=5]';
    $gal = apply_filters('the_content', $gal );
    echo $gal;
    ?>

    which displays the gallery with id number 5.

    I need to substitute '[gallery=5]' with a call to a specific custom value that will of course have the short tag format. How should I do? I have tried:

    <?php
    $gal = '<?php meta('camere'); ?>';
    $gal = apply_filters('the_content', $gal );
    echo $gal;
    ?>

    but I get an error.

  2. mariostella
    Member
    Posted 3 years ago #

    done with a query:

    <?php
    
    $gal = get_post_meta($post->ID, 'gallerypopup', true);
    
    $gal = apply_filters('the_content', $gal );
    
    echo $gal;
    
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic