In my single.php, I have the following:
<?php the_content(); ?> <?php echo do_shortcode('[gallery size="large"]'); ?>
My blog is essentially a photo blog, so I just want every post to have a large-size gallery after the content. That way, I don’t have to put <img> tags in my post text, I can just use the post text for a description of the photos and then any photos attached to the post just follow the content. It’s working out GREAT for 98% of my posts.
On the rare occasion, I want to stop that from happening, so I’m thinking all I need is to use a post_custom field and call it ‘nogallery’ and set that to 1 when I don’t want that to happen.
<?php the_content(); ?> IF POSTCUSTOMFIELD called "nogallery" = 1, THEN DO NOTHING ELSE <?php echo do_shortcode('[gallery size="large"]'); ?>
I’m not a PHP guru, so all of my attempts at crafting this IF/ELSE statement have failed.
Any help out there? THANKS!
- The topic ‘single.php – Using IF/ELSE on post_custom field to enable/suppress auto-gallery’ is closed to new replies.