Support Forum » User Profile

Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • raju.yarida@gmail.com[email protected]
    Participant

    please reply, if you need more info please let me know.

    in reply to: How to access older versions of extensions #46220
    raju.yarida@gmail.com[email protected]
    Participant

    Yes previous version of plugins is critical at least last 2 to 3 versions. If the latest updated one throws an error we must have the option to roll back.

    raju.yarida@gmail.com[email protected]
    Participant

    In addition to this, if i delete the Cloned Empty Start group and press save, it is saving but the updated data is missing one group, so it is removing actual data though it is empty.

    raju.yarida@gmail.com[email protected]
    Participant

    Hello Peter,

    Thank you for the insight.

    As per the previous suggestion, if I use a custom model, I have two questions:
    1. As my clone-able group of fields is the same, will this model work if I create a column for each subfield?
    2. Can I create these custom models dynamically by creating a function and passing the required field and all the values, or, as per the example in the documentation, each model should have all three hooks? with static values provided? Then, If I need 10 or more custom models, I have to create all three hooks for each custom model!

    raju.yarida@gmail.com[email protected]
    Participant

    Hello Peter,

    Thank you for the info.

    To test this, I have installed a new WordPress installation with Local. The most recent WordPress version, PHP 8.1.23, and MySQL 8.0.16 were used.

    Now, as per the custom table and model documentation, I have added the same example but modified little bit for my requirement. Added cloneable group of fields. The code which is added in functions.php is as below:

    add_action( 'init', 'twentytwentyfour_pattern_categories' );
    
    $model_name = 'metabox_pro'; // Example dynamic model name
    $table_name = 'metaboxes_pro'; // Example dynamic table name
    add_action( 'init', function() use ($model_name, $table_name) {
        mb_register_model( $model_name, [
            'table'  => $table_name,
            'labels' => [
                'name'          => 'Metaboxes Pro',
                'singular_name' => 'Metabox Pro',
            ],
            'menu_icon' => 'dashicons-money-alt',
        ] );
    } );
    
    add_action( 'init', function() use ($table_name) {
        MetaBox\CustomTable\API::create(
            $table_name,// Dynamic Table name.
            [
                'question' => 'TEXT',
                'answer_1' => 'TEXT',
                'answer_2' => 'TEXT',
                'answer_3' => 'TEXT',
                'answer_4' => 'TEXT',
                'answer_explanation' => 'TEXT',
                // Add more fields as needed.
            ],
            [],// List of index keys.
            true // Must be true for models.
        );
    } );
    
    add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) use ($model_name, $table_name) {
        $meta_boxes[] = [
            'title'        => 'Transaction Details',
            'models'       => [$model_name],
            'storage_type' => 'custom_table',  // Must be 'custom_table'
            'table'        => $table_name,
            'fields' => [
                [
                    'id'         => 'standard',
                    'type'       => 'group',  
                    'clone'      => true,     
                    'sort_clone' => true,
                    //list of sub-fields
                    'fields' => [
                        [
                            'id' => 'question',
                            'name' => 'Question',
                            'type' => 'wysiwyg',
                        ],
                        [
                            'id' => 'answer_1',
                            'name' => 'Answer 1',
                            'type' => 'wysiwyg',
                        ],
                        [
                            'id' => 'answer_2',
                            'name' => 'Answer 2',
                            'type' => 'wysiwyg',
                        ],
                        [
                            'id' => 'answer_3',
                            'name' => 'Answer 3',
                            'type' => 'wysiwyg',
                        ],
                        [
                            'id' => 'answer_4',
                            'name' => 'Answer 4',
                            'type' => 'wysiwyg',
                        ],
                        [
                            'id' => 'answer_explanation',
                            'name' => 'Answer Explanation',
                            'type' => 'wysiwyg',
                        ],
                    ],
                ],
            ],
        ];
    
        return $meta_boxes;
    } );

    But when I tried to add a new record in the backend, I got multiple console errors. Please see the attached screenshot here: https://pasteboard.co/wQFadTar6koY.jpg

    Please suggest if I missed anything in the code while creating custom model and custom table

    raju.yarida@gmail.com[email protected]
    Participant

    Also, If I use a custom model, am I able to create a dynamic custom model upon the creation of a custom post-type? How can I create/assign a cloneable group of custom fields for this custom model?

    raju.yarida@gmail.com[email protected]
    Participant

    Hello,

    Can you please explain why using custom models over custom tables is suggested?

    in reply to: Add Select Values from within the Custom Fields Group #44945
    raju.yarida@gmail.com[email protected]
    Participant

    previously added image not showing up, so adding a url where you can see.
    Screenshot of Image link

    raju.yarida@gmail.com[email protected]
    Participant

    I want to read this shortcode from a custom field like input/textbox and output that on the front end with a repeater of that custom posts (entering in the content is not required). Should be read from a custom field and work on a repeater in the front end. is it possible?

    raju.yarida@gmail.com[email protected]
    Participant

    Sorry to bother you, but can you please give me the code to get the URL value also?

    I want the home_page_top_ad_url also from the settings page group.

    I'm trying in two ways, one is:

    
    $group_value = rwmb_meta( 'home_page_top_ad_group' );
    $value = isset( $group_value['home_page_top_ad_url'] ) ? $group_value['home_page_top_ad_url'] : '';
    

    and

    
    $url = rwmb_meta( $group['home_page_top_ad_url'], ['object_type' => 'setting'], 'ev_advertisements' );
    

    In both ways, I'm not getting the value. Please help.

    raju.yarida@gmail.com[email protected]
    Participant

    sorry in the last code the if part was given wrong
    I was trying like follows:

    <?php $images = rwmb_meta( 'home_page_top_ad', ['size' => 'thumbnail'] ); ?>
    if (is_array($images) || is_object($images)) {
        foreach ( $images as $image ) {
            echo '<img src="', $image['url'], '">';
        }
    }

    How can I get the image URL from the settings gape field group?

Viewing 11 posts - 1 through 11 (of 11 total)