Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #15340

    I’ve looked through contact-form.php and class-form-generator.php but I can’t seem to find a way to move the contact page field labels above the fields. I can do an inspect element in Chromium and slide the <label for="avia_first_and_last_name">First and Last Name*</label> above <p class="" id="element_avia_first_and_last_name"> <input name="avia_first_and_last_name" class="text_input is_empty" type="text" id="avia_first_and_last_name" value="" style="background-image: none; background-position: 0% 0%; background-repeat: repeat repeat; "></p>, but I’m not sure how to translate that into the theme itself. I don’t want to mess with the CSS files unless I know exactly what I should edit. Anybody have a solution?


    Hi NivedRed,

    If you open framework/php/class-form-generator.php and scroll to lines 155 – 157 you’ll see the following:

    $this->elements_html .= "<p class='".$p_class."' id='element_$id'>";
    $this->elements_html .= ' <input name="'.$id.'" class="text_input '.$element_class.'" type="text" id="'.$id.'" value="'.$value.'"/><label for="'.$id.'">'.$element['label'].$required.'</label>';
    $this->elements_html .= "</p>";

    The second $this has the code for the label which is this:

    <label for="'.$id.'">'.$element['label'].$required.'</label>

    I believe all you need to do is move that ahead of the input like this:

    $this->elements_html .= "<p class='".$p_class."' id='element_$id'>";
    $this->elements_html .= ' <label for="'.$id.'">'.$element['label'].$required.'</label><br /><input name="'.$id.'" class="text_input '.$element_class.'" type="text" id="'.$id.'" value="'.$value.'"/>';
    $this->elements_html .= "</p>";

    I added a BR in between so the label and input would be on separate lines.

    Try that and see what it does. You may have to modify the CSS to position it correctly.




    *moved this question to the correct theme sub forum.



    @emoshun: Thanks.



Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Moving Contact Form Labels Above Fields’ is closed to new replies.