Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,696 through 1,710 (of 3,708 total)
  • Author
    Posts
  • in reply to: REST API Not showing all custom meta boxes #11743
    Anh TranAnh Tran
    Keymaster

    We have found the bug. There are meta boxes sharing the same ID, which makes them overwritten when getting values. In case anyone see the same bug, please change meta box IDs, making sure they're unique.

    in reply to: Can't see Metabox fields in MB Setting page. #11706
    Anh TranAnh Tran
    Keymaster

    Hi,

    Can you please post your code here?

    in reply to: Add an element #11705
    Anh TranAnh Tran
    Keymaster

    Hi James,

    Currently, the only way to do that is via JavaScript, e.g. using JS to add HTML to the page title.

    in reply to: Save to custom table of another plugin #11704
    Anh TranAnh Tran
    Keymaster

    Hi,

    If GD uses the same data structure as MB Custom Table, then it's possible. MB Custom Table's data structure is very simple:

    • Column ID: store the object ID (post ID or term ID).
    • Other columns: store the custom field values.

    It's fine if some columns are different, but the ID column must be used for object ID. In that case, you can use MB Custom Table to handle the job for you.

    in reply to: Drag and drop order reset without consent #11703
    Anh TranAnh Tran
    Keymaster

    You're right about the order for bi-directional relationships. I'll add a task on that.

    Thanks!

    in reply to: pre_get_posts to get all posts connected to single object #11702
    Anh TranAnh Tran
    Keymaster

    Hi Juanita,

    I can't see 2 screenshots :(.

    But I think the problem is the way you get query var. The get_query_var should not be used in this situation as it gets the value from the main query. Please replace the code with:

    $id = $query->get('relation_id');
    $from = $query->get('relation_from');
    $to = $query->get('relation_to');
    in reply to: REST API Not showing all custom meta boxes #11701
    Anh TranAnh Tran
    Keymaster

    Hi Peter,

    That's quite strange. I've just tried your code and all fields are showing up to me. Here is my screenshot:

    https://imgur.elightup.com/55TiHeL.png

    Can you check if those fields are not empty? Send me an email with a temporary admin account if you want me to look at the problem closer.

    Anh TranAnh Tran
    Keymaster

    Hi Ale,

    I've just checked the options for select_advanced field, looks like it's buggy when put in groups. I'll fix that.

    in reply to: Cannot add Custom Post Type #11690
    Anh TranAnh Tran
    Keymaster

    Hi Cornwall,

    Looks like no boxes causes no data is saved, and thus generate errors when registering the CPT. Can you drop me an email with a temporary admin account to check?

    in reply to: REST API Not showing all custom meta boxes #11689
    Anh TranAnh Tran
    Keymaster

    Hi Peter,

    All fields in all meta boxes are merged and displayed in REST API responses. I see the link https://www.pdpa.co.uk/wp-json/wp/v2/events shows some fields. Can you check that fields come from all meta boxes?

    In case there are some fields are missing, please check your code that registers meta boxes. Make sure there's no conditions like:

    if ( is_admin() ) { // Or any similar condition
       add_filter( 'rwmb_meta_boxes', 'your_meta_boxes' );
    }
    in reply to: Drag and drop order reset without consent #11688
    Anh TranAnh Tran
    Keymaster

    Hi Juanita,

    Did you save the post after reordering the relationships? The plugin relationship values in the exact order they're set in the backend. In the frontend, they're sorted by the ID columns from mb_relationships table. This is the query looks like in the plugin's code:

    https://imgur.elightup.com/tMMdiYH.png

    in reply to: Can't see Metabox fields in MB Setting page. #11687
    Anh TranAnh Tran
    Keymaster

    Hi,

    Have you created any meta box (with custom fields) for that settings page? In our documentation, there are 2 steps:

    • Creating a settings page
    • Creating settings fields for that settings page

    Make sure that you did both of them.

    Anh TranAnh Tran
    Keymaster

    Hi Ale,

    You're calling the field cellclasses, which is a sub-field of a group style. So the function rwmb_meta returns nothing, thus the next foreach loop doesn't work.

    You should get the value of the group style first, then get the value of sub-field. Like this:

    $style = rwmb_meta( 'style' );
    $cell_classes = isset( $style['cellclasses'] ) ? $style['cellclasses'] : array();
    foreach ( $cell_classes as $cell_class ) {
        echo $cell_class;
    }
    in reply to: Display CPT in page #11685
    Anh TranAnh Tran
    Keymaster

    Hi Huy,

    Your code has a PHP error and can't work. The function pt doesn't understand the variable $pricing.

    I have rewritten your code as follows, please try it:

    // Sub function
    function pt( $pricing ) {
      $table = isset( $pricing['pricing_table_id'] ) ? $pricing['pricing_table_id'] : '';
      if ( ! $table ) {
        return;
      }
      $plans = rwmb_meta( 'plan', '', $table );
      if ( empty( $plans ) ) {
        return;
      }
      foreach ($plans as $plan) {
        $name = isset( $plan['plan_name'] ) ? $plan['plan_name'] : '';
        echo $name;
      }
    }
    
    //Main function
    function page_section() {
      $sections = rwmb_meta( 'section' );
      if ( ! empty( $sections ) ) {
        return;
      }
      foreach ( $sections as $section ) {
        if ( empty( $section['section_pricing'] ) {
          continue;
        }
        $pricing = $section['section_pricing'];
        pt( $pricing );
      }
    }
    in reply to: Data are not saved into the database. #11684
    Anh TranAnh Tran
    Keymaster

    Hi Vadym,

    I see you're using Gutenberg. This editor saves custom fields via ajax calls. So, can you try waiting for 1-2 seconds after post is saved, just to make sure the custom fields's ajax call is finished, and check the data again?

Viewing 15 posts - 1,696 through 1,710 (of 3,708 total)