post title

Support MB Frontend Submission post titleResolved

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #40682
    hello@twosixmedia.co.uk[email protected]
    Participant

    I have 2 forms one for a site and another for a sub site - the form on the sub-site doesn't seem to work with the post title - I have included the shortcode for the form. the post type is set to not support the title on both post types is this correct - seems to work on the main form

    [mb_frontend_form id='green-care-sub-site-form' post_fields='title' post_type='green-care-sub-site' redirect='https://sfgqualitymark.org.uk/user-dashboard-sub-site/' submit_button='Save Your Form']

    https://sfgqualitymark.org.uk/green-care-sub-site-form/

    kind regards

    Paul

    #40695
    PeterPeter
    Moderator

    Hello,

    I see this is the title field in the frontend form https://monosnap.com/file/fZ5SuBuxE66vJExPIwsq0L8MAVvMyd
    But somehow it does not have the correct ID, should be post_title. Can you please try to deactivate all plugins except Meta Box, MB extensions and switch to a standard theme of WordPress then check this issue again?

    #40762
    hello@twosixmedia.co.uk[email protected]
    Participant

    This is a live site - so can't really do that

    but there is another form which works fine - is there a clash there?

    https://sfgqualitymark.org.uk/green-care-form/

    #40768
    PeterPeter
    Moderator

    Hello,

    Yes, I see the post title work on the page https://sfgqualitymark.org.uk/green-care-form/
    But I'm not sure why this happens on another page without some troubleshooting steps. Can you please copy your site to a staging site and do the test there?

    #40781
    hello@twosixmedia.co.uk[email protected]
    Participant

    I have done this and I think it's down to one of these bits of code - or both - you gave me this code so not sure but when I turn both off it seems to work - can we combine them maybe

    they alter the label of the title field for both forms

    <?php
    
    add_filter( 'rwmb_frontend_post_title', function( $field ) {
    if ( is_page( "Green Care Form" ) ) {
        $field['required'] = true;
        $field['name'] = 'Name of Green Care organisation';
        return $field;
    }
    } ); 
    
    ?>
    
    <?php
    
    add_filter( 'rwmb_frontend_post_title', function( $field ) {
    if ( is_page( "Green Care Sub Site Form" ) ) {
    $field['required'] = true;
    $field['name'] = 'Name of Green Care Sub Site';
    }
    return $field;
    } );
    
    ?>
    #40792
    PeterPeter
    Moderator

    Hello,

    I see the code snippet in the topic https://support.metabox.io/topic/user-dashboard-displaying-the-right-form/?swcfpc=1

    As the suggestion, please move the return statement outside of the condition if statement and check the title again.

    add_filter( 'rwmb_frontend_post_title', function( $field ) {
    if ( is_page( "Green Care Form" ) ) {
    $field['required'] = true;
    $field['name'] = 'Name of Green Care organisation';
    }
    return $field;
    } );
    #40793
    hello@twosixmedia.co.uk[email protected]
    Participant

    is that on both of them?

    and do you mean like below - sorry not a coder!

    add_filter( 'rwmb_frontend_post_title', function( $field ) {
    if ( is_page( "Green Care Form" ) ) {
    $field['required'] = true;
    $field['name'] = 'Name of Green Care organisation';
    }

    } );

    return $field;

    #40798
    PeterPeter
    Moderator

    Hello,

    Just the first block of code for the "Green Care Form" page as I mentioned above.

    add_filter( 'rwmb_frontend_post_title', function( $field ) {
        if ( is_page( "Green Care Form" ) ) {
            $field['required'] = true;
            $field['name'] = 'Name of Green Care organisation';
        }
    
        return $field; // here
    } );
    #40806
    hello@twosixmedia.co.uk[email protected]
    Participant

    thank you for your patience that seems to have worked

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.