WordPress.org

Support

Support » Plugins and Hacks » Custom Content Type Manager » [Resolved] [Plugin: Custom Content Type Manager] Conditional statement

[Resolved] [Plugin: Custom Content Type Manager] Conditional statement

  • I there, I really enjoy to get to know your plugin. I can now built more personal website and that is so great.

    As for now, i’m working on template and have some questions. For the moment, i’ll only ask about not displaying an empty custom field. I mean if the custom field is empty, i won’t print any label either.

    As for my small knowledge, it works with :


    <?php if($custom_field_name !== '') { ?>
    LABEL: <?php echo $custom_field_name; ?>
    <?php } ?

    Can you help me manage this part please.
    By the way, i read the 7 pages of topics here to find solution…

    Namaste, Lp(*

    http://wordpress.org/extend/plugins/custom-content-type-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • This works for me.

    <?php
    $city = get_custom_field('location_city');
    
    if ($city !== ''): ?>
    	<strong>Location: City</strong> <?php echo $city; ?>
    <?php endif ?>

    Here is a bit shorter and cleaner.

    <?php
    if ((get_custom_field('location_city')) !== ''): ?>
         <strong>Location: City</strong> <?php print_custom_field('location_city'); ?><br />
    <?php endif ?>

    Thank you, it’s really appreciate!

    Glad I could help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Custom Content Type Manager] Conditional statement’ is closed to new replies.
Skip to toolbar