Custom Fields
Re-Envisioned
Support MB Frontend Submission How to set the post title to my Name input field? Reply To: How to set the post title to my Name input field?

#9635

Anh Tran
Keymaster

Hello,

The post title is displayed in the post_fields attribute of the shortcode. Please use the MB Frontend Submission to add other fields to the form.

In your situation, it sounds like changing the label for post title from “Post Title” to “Name”.

So, please create a folder in your theme called mb-frontend-submission. Inside that folder, create a sub-folder called post. And inside post, create a file title.php, which contains the following code (don’t worry, just copy and paste):

<?php
$title = $data->post_id ? get_post_field( 'post_title', $data->post_id ) : '';
$field = apply_filters( 'rwmb_frontend_post_title', array(
    'type' => 'text',
    'name' => esc_html__( 'Name', 'rwmb-frontend-submission' ),
    'id'   => 'post_title',
    'std'  => $title,
) );
$field = RWMB_Field::call( 'normalize', $field );
RWMB_Field::call( $field, 'admin_enqueue_scripts' );
RWMB_Field::call( 'show', $field, false, $data->post_id );

That’s it!

Please try and let me know how it works.