[resolved] A Checkbox to display or disable content (2 posts)

  1. Dave Meier
    Posted 5 years ago #

    I have a custom post type which I would like to add a content box to.

    Some of the pages won't have this box so I have added a checkbox into a custom metabox.

    I would like to only display the box on my site when I tick the checkbox.
    I suppose it is similar to showing or hiding the comments options on a page.

  2. Dave Meier
    Posted 5 years ago #

    got this working my by adding in:

    <? if (get_post_meta($post->ID, 'hd_checkitem', true)) { ?>
        my content here
        <? } else { ?>
    <? } ?>

    hd_checkitem is just the name from the prefix and id for that item in the metabox

Topic Closed

This topic has been closed to new replies.

About this Topic