Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author donmik

    (@atallos)

    In the latest version 1.5.4, I have created a filter “bxcft_show_field_value”. You can use it to check if the field is empty.

    Thread Starter inactive

    (@nurdanucergmailcom)

    Thank you, could you possibly post a small snippet as to how I can use it in templates?

    <?php function bxcft_get_field_value('myfield'); ?>

    doesn’t seem to work.

    Thread Starter inactive

    (@nurdanucergmailcom)

    * Sorry I meant:

    <?php function bxcft_show_field_value('field=myfield'); ?>

    Plugin Author donmik

    (@atallos)

    In the FAQ which I’ve uploaded today, you can see how to use the filter. In your case I suppose you need to do something like this:

    add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
        if ($type == 'image') {
            $value = str_replace("<p>", "", $value);
            $value = str_replace("</p>", "", $value);
            if ($value != '') {
                   return '<p><img src="'.$uploads['baseurl'].$value.'" alt="" /></p>';
            } else {
                 return YOUR_DEFAULT_IMAGE;
            }
        }
        return $value_to_return;
    }

    Something like this might work.

    Thread Starter inactive

    (@nurdanucergmailcom)

    Thank you, that’s exactly what I need.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Setting Default Values for Empty Fields Programmaticaly?’ is closed to new replies.