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 having trouble with galleries being stripped/filtered out of the content of the post excerpts before the "read more" click (the galleries load just fine when you click and read the post all by itself on a full page).

Something in the template is stripping that out (there are lots of filters in the theme options, none of which have worked turning them off).

Does anyone know what code to look for that might be stripping something like the standard wordpress galleries? I'm somewhat new to Wordpress and not great at php, so wondering if anyone knew what I should look for.

Side notes: Other templates display it correctly, other gallery plugins do the same thing, there is an extra file content_gallery.php, I don't see any "filters" besides using functions to strip.

share|improve this question
    
I'm pretty sure that WordPress strips out all formatting and shortcodes (including the [gallery] shortcode) from the_excerpt() function. Using the_content() instead will fix this problem. –  bungeshea Jul 18 '13 at 0:34
    
@bungeshea, nope, using twentytwelve / eleven / ten / etc. all of them show the gallery in the post before clicking read more. :/ –  user35452 Jul 18 '13 at 0:40
    
Twenty Twelve and Twenty Eleven uses the_content() everywhere except on searches where the_excerpt() is used. Twenty Ten always uses the_content() –  bungeshea Jul 18 '13 at 0:47
    
omg bungeshea you are an absolute LIFESAVER! I knew it was something incredibly simple like that!!!! Thank you thank you thank you! –  user35452 Jul 18 '13 at 1:07
    
Glad I could help :) I've posted the solution as an answer so you can mark it as correct –  bungeshea Jul 18 '13 at 1:14
add comment

1 Answer 1

up vote 1 down vote accepted

Your theme most likely uses the_excerpt() function. This function takes the post content and removes all formatting and shortcodes (including the [gallery] shortcode), and truncates it to a certain amount of characters.

What you could try is removing this function, and replacing it with the_content(), which still respects the <!-- more --> tag in posts, but correctly displays shortcodes and HTML formatting.

share|improve this answer
    
works perfectly! For my template, it was in the content.php file for anyone searching for what to replace, and the original template designer used theme_get_content() and theme_get_excerpt() instead of what's above. I hope those aren't old depreciated wordpress functions and just custom functions by the designer (I think they're custom because I think I recall the_content() in other places somewhere. –  user35452 Jul 18 '13 at 1:33
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.