Hi,

I try to add a custom table into my WordPress installation (cloudways, mariadb) with OxygenBuilder. I also tried to add custom fields via the metabox generator (I know, I have metabox AIO, so I can do it via admin). No luck so far. Where / how do I add these lines of code to act like the functions.php

see this tutorial: https://docs.metabox.io/extensions/mb-custom-table/

custom table:

<?php

add_action( ‘init’, ‘prefix_create_table’ );
function prefix_create_table() {
if ( ! class_exists( ‘MB_Custom_Table_API’ ) ) {
return;
}
MB_Custom_Table_API::create( ‘wp3y_vbwp_reviews’, array(
‘klant_review_titel’ => ‘TEXT’,
‘klant_review_text’ => ‘TEXT’,
‘klant_review_beoordeling’ => ‘DECIMAL’,
‘klant_review_avatar’ => ‘BLOB’,
‘klant_review_beoordeelt’ => ‘TEXT’,
) );
}

add_filter( ‘rwmb_meta_boxes’, ‘your_prefix_register_meta_boxes’ );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array(
‘title’ => ‘Meta Box Title’,
‘storage_type’ => ‘custom_table’, // Important
‘table’ => ‘wp3y_vbwp_reviews’, // Your custom table name
‘fields’ => array(
array(
‘id’ => ‘klant_review_title’,
‘type’ => ‘text’,
‘name’ => ‘Klant review titel’,
),
array(
‘id’ => ‘klant_review_text’,
‘type’ => ‘text’,
‘name’ => ‘Klant review text’,
),
array(
‘id’ => ‘klant_review_beoordeling’,
‘type’ => ‘decimal’,
‘name’ => ‘Klant review beoordeling’,
),
array(
‘id’ => ‘klant_review_avatar’,
‘type’ => ‘blob’,
‘name’ => ‘Klant review avatar’,
),
array(
‘id’ => ‘klant_review_beoordeelt’,
‘type’ => ‘text’,
‘name’ => ‘Klant review beoordeelt’,
),
),
);
return $meta_boxes;
}

One response to “metabox custom table”

  1. cmsexpertss says:

    Hi,

    Thank you for contacting us. The site information you provided is incomplete as you didn’t provided any login credentials. So, please provide login access also so I could look into this.

    Regards,
    Muhammad Osama

Leave a Reply

Your email address will not be published.