Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Try this before using the print method on the field:

    <?php
    if ( $this->field->name == 'field_with_placeholder' ) {
       $this->field->attributes['placeholder'] = 'placeholder text';
    }
    $this->field->print_element_with_id();
    ?>
    Thread Starter gwydionismyhero

    (@gwydionismyhero)

    Thank you! This worked for me.

    Thread Starter gwydionismyhero

    (@gwydionismyhero)

    And if this helps anyone, I modified the code to use the help text as placeholder.

    <?php
    if ( $this->field->has_help_text() ) {
       $placeholder = $this->field->help_text;
       $this->field->attributes['placeholder'] = $placeholder;
    }
    $this->field->print_element_with_id();
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Placeholder Attribute’ is closed to new replies.