I want my user to able to add a gallery to a post and then run a conditional like:

<? php
if (strpos($post - > post_content, '[gallery') !== false) {
    echo do_shortcode('[gallery]');
} else {
} ?>

But using wordpress' stock gallery and adding it to a post also shows the gallery inside the content.

I have a 2 column layout, the right column has the_content() but I want the left column to display the gallery if it has one.

How do I go about making this work?


This method enables you to display the native WordPress gallery using the gallery shortcode in a custom function How to call a plugin function in footer.php

You can use any WordPress or theme specific hook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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