if metdata is checked not working
-
Trying to fix this and I know it’s easy, but cannot figure it out for the life of me. I just need to check if my metadata checkbox is checked. Basically I have a custom post type called products that works great in my catalog loop. However, I have a homepage with a small gallery that only displays a select few. This is where my gallery checkbox comes into play.
However, I cannot get an if statement to work correctly. I don’t get why my logic isn’t working. I just get a bunch of ‘Don’t show in gallery’ lines even though the checkbox is checked and saved/updated correctly. Basically, it’s saying they are all false and I have two of them checked and saved for testers. WEIRD!
$gallery = get_post_meta($post->ID, 'gallery', true); if($gallery == true) { echo 'Show in gallery'; } else { echo 'Don't show in gallery'; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘if metdata is checked not working’ is closed to new replies.