This topic contains 15 replies, has 3 voices, and was last updated by  Garth John 9 months, 1 week ago.

  • Creator
    Topic
  • #11738
    Resolved
    Pascal Genest
    Participant

    Hi.. I just installed a fresh WP Installation, with only MB plugins (MB and FrontEnd) and a plugin that create a Custom Type. Here below is the shortcode typed, with the code used to create the custom type. The problem is : the frontend doesn’t display.

    shortocde :
    [mb_frontend_form id=”vxp_contacts_data” post_fields=”title”] 

    code for custom Type and metabox :

    https://ghostbin.com/paste/a3das

Viewing 10 replies - 1 through 10 (of 15 total)
  • Author
    Replies
  • #11755

    Anh Tran
    Keymaster

    Hi Pascal,

    I answered you via email. Posting here in case anyone needs it:

    I see you’re using the old syntax of Meta Box to register meta boxes. I’ve made the change to this: https://ghostbin.com/paste/d2k7b

    Please try it.

    Note that the way to register directly via class RW_Meta_Box is not supported anymore. While it might work in normal cases, it’s not compatible with other extensions. Please see the docs here: https://docs.metabox.io/creating-meta-boxes/

    Let me know if you see any bug.

    #12870

    Garth John
    Participant

    Hi I have my meta boxes working in the back end with all my custom fields. But I just bought the front end submissions plugin and have written my code below. The problem is it just echo’s the string onto the page and doesn’t put out the front end form. The code is giving me all the right fields in the admin end of wordpress. But trying to use it in the front end, it just echo’s the string. And I have added my license key to the updater.

    My php Shortcode

    
    <?php  
        $form = '[mb_frontend_form id="deposit_price"]';
        echo do_shortcode( $form );
    ?>
    

    My php Meta Box Code

    
    function add_meta_fields( $meta_boxes ) {
            $meta_boxes[] = array(
              'id' => 'deposit_price',
              'title' => 'Finance' ,
              'post_types' => array('rentals'),
              'context' => 'normal',
              'autosave' => false,
              'fields' => array(
                array(
                    'id' => 'deposit_price_field',
                    'type' => 'number',
                    'name' => 'Deposit',
                    'placeholder' => 'Just the number : 123456',
                ),
              ),
            );
        return $meta_boxes;
      }
    add_filter( 'rwmb_meta_boxes', 'add_meta_fields' );
    
    #12888

    Anh Tran
    Keymaster

    Hi Garth John,

    Did you activate both Meta Box and MB Frontend Submission plugins together?

    #12908

    Garth John
    Participant

    Yeah I activated them together. I saw the MB Icon only shows if you have both activated at the same time. I have also added the updater plugin to input my activation code.

    #12917

    Anh Tran
    Keymaster

    Hi Garth John,

    Do you have any condition when registering the meta boxes? Something like is_admin(). Or you have some condition when load the PHP file that contains the meta boxes code. The MB Frontend Submission only works if the meta boxes registered on both front end and back end.

    #12918

    Garth John
    Participant

    Hi Anh Tran
    I don’t have any is_admin() conditions written into my code. I haven’t needed it. However. I’m not sure about the forms been registered on both front end and back end.
    How can I check this?

    Currently my forms work in the back end but not the front end. So I’m wandering if maybe it’s because I haven’t registered my form for the front end.

    Also another thing I noticed is that I purchased the front end submissions extension. But then I see you guys have packages for core, developer and lifetime. I only purchased the front end submissions extension though. Is this right? I only need the front end submissions extension I don’t need the others.

    Thank you for the help.

    #12919

    Anh Tran
    Keymaster

    Hi Garth,

    To check if the meta box is registered only for admin, please check the PHP file that has the meta box code. You might want to check something similar to this:

    add_action( 'admin_init', 'your_function' );
    function your_function() {
        add_filter( 'rwmb_meta_boxes', 'your_meta_boxes' );
    }
    
    // Or
    if ( is_admin() ) {
        include 'your-meta-boxes.php';
    }

    Regarding the purchase: yes, you only need the Frontend Submission extension.

    #12920

    Garth John
    Participant

    This is how I’ve written my code for the meta boxes. with each $meta_boxes[] = array() adding a field to whichever post I have set it to. I have added many fields so I just took the start and finish of the code with one of the items I have added.

    <?php  
        function add_meta_fields( $meta_boxes ) {
            $meta_boxes[] = array(
                'id' => 'area',
                'title' => 'Area' ,
                'post_types' => array( 'for_sale',' ' ),
                'context' => 'normal',
                'autosave' => false,
    
                'fields' => array(
                    array(
                    'id' => 'address',
                    'name' => 'Address',
                    'type' => 'text',
                    ),
                    array(
                        'id' => 'map',
                        'name' => 'Location',
                        'type' => 'map',
                        // Default location: 'latitude,longitude[,zoom]' (zoom is optional)
                        'std' => '-6.233406,-35.049906,15',
                        // Address field ID
                        'address_field' => 'address',
                        // Google API key
                        'api_key' => 'MY_API_KEY_IS_INSERTED_HERE',
                    ),
                ),
            );
            return $meta_boxes;
            }
        add_filter( 'rwmb_meta_boxes', 'add_meta_fields' );
    ?>
    
    #12921

    Garth John
    Participant

    This is how I am calling my form with the shortcode. [mb_frontend_form id=”area”]

    #12922

    Anh Tran
    Keymaster

    How did you call the shortcode? Did you put it in post content or text widget?

    If you call with PHP like

    echo '[mb_frontend_form id="area"]';

    Then it doesn’t work. The correct code is:

    echo do_shortcode( '[mb_frontend_form id="area"]' );

Viewing 10 replies - 1 through 10 (of 15 total)

You must be logged in to reply to this topic.