• Hello, Relatively new with WordPress, but ive had experience over the years.
    Ive come to an issue where im trying to get image to dispaly on the page with this code:

    
    <h2 style="text-align: center;">Gallery</h2>
    [gallery size="medium" ids="2763,2761,2762"]
    

    but all that that is displays is:

    [gallery size="medium" ids="2763,2761,2762"]

    WOuld anyone know why this occurs?

    Thanks so much

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Whatever is causing this output does not have the output passing through do_shortcode(). Usually, do_shortcode() is added as a filter callback to the_content(), so any time the_content() is used, shortcodes are automatically expanded. When the_content() is not used, then do_shortcode() is also not used.

    If you alter the template code causing the output to first pass the output through do_shortcode(), any shortcodes like [gallery] will be expanded.

    This code will result in the undesirable output you’ve observed:
    echo '[gallery size="medium" ids="2763,2761,2762"]';

    This code will display an image gallery:
    echo do_shortcode('[gallery size="medium" ids="2763,2761,2762"]');

Viewing 1 replies (of 1 total)

The topic ‘Issue with getting gallery to display’ is closed to new replies.