Support » Plugin: More Fields » Add some css by morefields checkbox

  • It’s probably a stupid question but i just can’t get it to work and I also cannot find the answer anywhere.

    I have a custom post type called ‘projecten’ with 3 morefields, 2 textline’s and one chekbox.

    The textboxes are working great, people can enter the text they want to appear in de ‘project’.

    I loop the featured image and in the left top of the div there is an picture that is absolute positioned and 80px width, it’s an stamp to say the project is new.

    Above that i have a black box where people can fill in something through the morefields.

    Now what i want to happen is that when people check the checkbox ‘nieuw’ on the project page that the black box move 80px to the left so the ‘new’ stamp will appear.

    i have this code now:

    <?php if (get_post_meta($post->ID, ‘new-project-check’, true) ) : ?>
    <style type=”text/css”>
    .extracontent-block .stamp{
    left: 80px;
    <?php endif; ?>

    but that doesn’t seem to work.
    Sorry for the long question I’m building the site on my localhost so i cant just send you an link to the site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Oke, i fixed it with the following code:

    <?php $stampnewproject = get_post_meta( $post->ID, ‘stampnewproject’, true ); ?>
    `<?php if($stampnewproject) { ?>
    <div id=”newblock”>Nieuw</div><div class=”stamp checked”><?php meta(‘black-text-stamp’); ?></div>
    <?php } else { //if checkbox isn’t checked?>
    <div class=”stamp”><?php meta(‘black-text-stamp’); ?></div>
    <?php } ?>`

    But now i cannot check the boxes anymore..

    I think that is because the stamp div or some other class is above the checkbox input (like layers)
    Put a class on that checkbox and add it an absolute or relative position, then type a higher z-index value. Try a super big number to see if that works (like 1000) and if it does work, then thats it, try a 2 or 3 for it to stay at top of the stamp or the class blocking it

    No that wasn’t the problem, the stamp already had a higher z-index.
    Thanks for the suggestion anyway.

    For some reason it just didn’t work in the header.
    When I used in the body it worked.
    Now I have the problem thecheckbox doesn’t stay checked after I saved it.

    Maybe it’s time to learn how to create meta fields myself

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add some css by morefields checkbox’ is closed to new replies.