WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Advanced Custom Fields] Can custom fields be *optional*?

[Resolved] [Plugin: Advanced Custom Fields] Can custom fields be *optional*?

  • I am 100% new to php so please forgive the ignorance in my question.

    I have followed directions and managed to get custom fileds into my template page. However, I wonder if there is some sort of code which can conditionally prevent a field from appearing if the value is left blank (or if value = “blank”)

    An example to illustrate the functionality I am after: my client offers sports training. Each course he offers has a list of details (price, location, training duration, number of participants, etc…). Then there are certain trainings in which only a certain number of those fields apply (for example: a one-on-one training obviously excludes the need to specify number of participants)

    Is there a piece of code which could specify that if a certain field has a value of “blank” or “empty” (or even better, if it is just left blank in the dashboard), then that field will not appear?

    Currently, all my fields appear no matter what.

    Thanks in advance.

    http://wordpress.org/extend/plugins/advanced-custom-fields/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Perhaps I need to make a template for each type of training if they require different fileds, but I wanted to be sure there isn’t some work around first.

    Plugin Author elliotcondon
    Member

    @elliotcondon

    Hi @lucaslem

    These are called “conditional statements” – “if statements”.

    Please jump onto the ACF website and read the docs / code examples to see this in action

    Cheers
    Elliot

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: Advanced Custom Fields] Can custom fields be *optional*?’ is closed to new replies.