Title: Please help hide custom field
Last modified: August 19, 2016

---

# Please help hide custom field

 *  [Levente24](https://wordpress.org/support/users/levente24/)
 * (@levente24)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/please-help-hide-custom-field/)
 * Hello, i have aproblem.
 * I made a slider what i can hide if is check a check box.
 * I even gave it an input where you can add the folder locaton, but i cant make
   it to hide if the folder is empty or its not correct
 * this is the code
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * i tryed to give it to a variable and if its empty than hide it not working i 
   tryed wit if(get_post_meta($post->ID, ‘main_folder’, true) !== ”)
 * and that doesnt work either, could please someone give me a hint what im missin?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [transom](https://wordpress.org/support/users/transom/)
 * (@transom)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/please-help-hide-custom-field/#post-2027142)
 * Well based on the example in your code – try changing the compare operator from(!
   ==) to (!=) for valid PHP.
 *  Thread Starter [Levente24](https://wordpress.org/support/users/levente24/)
 * (@levente24)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/please-help-hide-custom-field/#post-2027145)
 * thank you for your reply but this doesnt work either
 *  [transom](https://wordpress.org/support/users/transom/)
 * (@transom)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/please-help-hide-custom-field/#post-2027256)
 * Paste your code as outlined above and someone will be able to make a better guess
   on what is going wrong.
 *  Thread Starter [Levente24](https://wordpress.org/support/users/levente24/)
 * (@levente24)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/please-help-hide-custom-field/#post-2027367)
 * here is the code
 *  <?php if(is_category(7) || is_page(11) && get_post_meta($post->ID, ‘m_slider’,
   true) == ‘true’ || 11 == $post->post_parent && get_post_meta($post->ID, ‘m_slider’,
   true) == ‘true’) {?>
    <div id=’slider_bg’> </div><!– slider_bg –> <div id=’slider_img’
   > <div class=”slider” > <img src='<?php bloginfo(‘template_url’); ?>/slider/<?
   php echo get_post_meta($post->ID, ‘main_folder’, true); ?>/1.jpg’> <img src='
   <?php bloginfo(‘template_url’); ?>/slider/<?php echo get_post_meta($post->ID,‘
   main_folder’, true); ?>/2.jpg’> <img src='<?php bloginfo(‘template_url’); ?>/
   slider/<?php echo get_post_meta($post->ID, ‘main_folder’, true); ?>/3.jpg’> <
   img src='<?php bloginfo(‘template_url’); ?>/slider/<?php echo get_post_meta($
   post->ID, ‘main_folder’, true); ?>/4.jpg’>
 *  </div>
    </div> <?php } ?>
 *  [transom](https://wordpress.org/support/users/transom/)
 * (@transom)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/please-help-hide-custom-field/#post-2027427)
 * Your slide will show up on any category(7) archive, or
    if this is page 11 or
   a child of page 11
 * testing for true in quotes is NOT the same as testing for true (not in quotes)–
   the better test would be get_post_meta($post->ID, ‘m_slider’, true) != ”
 * On the third term – you are testing the custom field the current page – not the
   custom field of page 11 (which is what I suspect you want)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Please help hide custom field’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [transom](https://wordpress.org/support/users/transom/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/please-help-hide-custom-field/#post-2027427)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
