• 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. Please use the pastebin]

    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)
  • Well based on the example in your code – try changing the compare operator from (!==) to (!=) for valid PHP.

    Thread Starter Levente24

    (@levente24)

    thank you for your reply but this doesnt work either

    Paste your code as outlined above and someone will be able to make a better guess on what is going wrong.

    Thread Starter Levente24

    (@levente24)

    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 } ?>

    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.