Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm developing a new custom theme - and noticed that if a post contains the shortcode [gallery] it gets ignored (edit: I mean that the HTML delivered to the browser does not include [gallery], nor anything in its place... I think there's a blank line or two)

My Theme is

  1. grabbing post contents via the_content('→');
  2. also removing the standard <p></p> wrapper via remove_filter('the_content', 'wpautop');

The Codex does not list this as one of the features you explicitly have to add support for - but we know the codex can be outdated/incomplete at times.

Anyways, what is it needed for a theme to recognize [gallery] (and/or other such standard shortcodes) ?

share|improve this question
1  
Define ignored ? [gallery] remains in page source? [gallery] disappears and is not replaced by anything? –  Rarst Jan 3 '11 at 13:36
    
@Rarst: (thanks; I edited the question to clarify) I mean that the HTML delivered to the browser does not include [gallery], nor anything in its place... I think there's a blank line or two –  FOR Jan 3 '11 at 14:23
1  
@FOR have you added any images to the page in which you are using the gallery? [gallery] won't work without there actually being attachments on said post. –  eileencodes Jan 3 '11 at 14:30
    
@eileen.carpenter thanks for the tip. I am using the standard post from Theme Unit Test, specifically the 'Images Test' post. I imported with the option to grab the attachments, and there are other images on that post so I think there's data for [gallery] to work (but will look more into it) –  FOR Jan 4 '11 at 1:42
    
Seems you had it right, @eileen.carpenter ! I edited the gallery and added images to it: it appeared. Guess the sample data for the Theme Unit Test list does not bring in all of the data needed! Thank you! If you add an answer I'll accept it - for now, a +1 to your comment as a token –  FOR Jan 4 '11 at 1:49
show 1 more comment

1 Answer

up vote 2 down vote accepted

Have you added any images to the page in which you are using the gallery?

The [gallery] shortcode won't work without there actually being attachments on said post.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.