Conditionals, field formatting and CustomPress

Hi,

I'd like my CustomPress fields to only display if content has been added. I'm using the following on incsub_wiki.php <?php echo do_shortcode('[ct id="ct_Yes_Point__text_dd31" property="title | description | value"]'); ?> can you tell me what code I'd need to wrap this in to make it work in the way I want?

Also, I see that CustomPress fields support HTML entry, is it possible to make it support BB Code also? And is there any way to make http://whatever.com turn into a link automatically?

Lastly, is there a way to make CustomPress fields support wpautop?

Thanks.

  • Kimberly

    Hello Dave,

    Here is some good discussion on Custom Fields displaying Conditionally

    http://wordpress.stackexchange.com/questions/16108/display-custom-field-only-if-value-present

    Being that CustomPress is a building block for so many other things I don't think the developer will be including that feature anytime soon.

    I'll see if the developer can comment with some extended feedback for you :slight_smile:

    He is much better at CustomPress info

    Best,

    Kimberly

  • Arnold

    "I'd like my CustomPress fields to only display if content has been added."

    Not quite sure what you want here. If a field is empty it would return an empty string.
    An empty string is no display right?

    If you mean also remove any formatting you put around it, that wouldn't be the province of the plugin. Generally if you're workingin a template you can do things like.

    <?php
    $cfv = do_shortcode('[ct id="ct_Yes_Point__text_dd31"]');
    if( ! empty($cfv) ):
    ?>
    
      <div>whatever formatting you like <?php echo $cfv ?> </div> 
    
    <?php endif; ?>

    Supporting bbcode wiuld require something that can interpret bbcode which again is beyond the scope of the plugin.

    Doing a link

    <a href="<?php echo do_shortcode('[ct id="ct_Yes_Point__text_dd31"]') ?>" ><?php echo do_shortcode('[ct id="ct_Yes_Point__text_dd31"]') ?></a>

    If you're expecting it to recognize an url embeded in other text and automatically convert it, again that would be outside the plugins purpose. You wouldn't expect MySql to automatically convert the links in text stored in a database.

    However since we're in Wordpress you can use make_clickable.

    <?php echo make_clickable(do_shortcode('[ct id="ct_Yes_Point__text_dd31"]') ); ?>

    Doing wpautop

    <?php echo wpautop(do_shortcode('[ct id="ct_Yes_Point__text_dd31"]') ); ?>