Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,726 through 1,740 (of 3,958 total)
  • Author
    Posts
  • 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?

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

    Hi Juanita,

    The parse_query hook runs just before pre_get_posts and there's nothing between them. See this screenshot:

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

    So, if your code works with pre_get_posts, it should work with parse_query. I guess the problem might come from other things.

    in reply to: Data types for MB fields #11682
    Anh TranAnh Tran
    Keymaster

    Hi Purdue,

    All types should use text or equivalent type for storing the data. So TEXT NOT NULL is the general type.

    But if your data is short, or you want to tell MySQL to index the field (e.g., making the field a key), then you should use VARCHAR(length) NOT NULL. MySQL can't index a text field without knowing its max length.

    in reply to: New contexts broken with Gutenberg #11674
    Anh TranAnh Tran
    Keymaster

    @Ale: No, it's not. Gutenberg is JavaScript-editor and it doesn't support many PHP hooks, including contexts.

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

    Hi Juanita,

    You're right about the query var. And your idea of adding the query var is great. I think the only problem is using pre_get_posts is too late. The plugin uses parse_query hook to setup some parameter for the SQL. So you might want to change your code from pre_get_posts to parse_query.

    in reply to: Data are not saved into the database. #11658
    Anh TranAnh Tran
    Keymaster

    Hi Vadym,

    Can you take a screenshot of the edit screen with all questions and answers?

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

    Hi Cornwall,

    Can you enable debugging and see if there's any PHP error on the "New Post Type" screen?

    in reply to: Display CPT in page #11656
    Anh TranAnh Tran
    Keymaster

    For better organization, I put each module in separate files which are located in different folder.

    This is great and is a recommended way to organizing fields. I also wrote about this.

    Problem is value in fields cannot be retrieved, all none whilst html output is OK.

    Can you provide more details on how you retrieve values? Code is appreciated.

    in reply to: Datetime validation #11655
    Anh TranAnh Tran
    Keymaster

    Hi,

    The datetime fields doesn't do validation for the format. It's kind of a bug in jQueryUI datepicker. I'd suggest setting the field readonly to prevent users entering values in wrong format.

    Anh TranAnh Tran
    Keymaster

    Hi Purdue,

    I've just pushed an update for both MB Revision and MB Custom Table. Now they work well together and you can use them to track revisions for CPT in custom tables. Please update and let me know if you find any problem.

    in reply to: Display CPT in page #11642
    Anh TranAnh Tran
    Keymaster

    Have you resolved this? Do you need any further help?

Viewing 15 posts - 1,726 through 1,740 (of 3,958 total)