Forum Replies Created
-
AuthorPosts
-
August 25, 2024 at 10:06 AM in reply to: Clone Empty Start in Group field issue for already have some data in that post #46239
[email protected]
Participantplease reply, if you need more info please let me know.
[email protected]
ParticipantYes 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.
August 22, 2024 at 11:03 PM in reply to: Clone Empty Start in Group field issue for already have some data in that post #46210[email protected]
ParticipantIn 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.
May 7, 2024 at 7:22 PM in reply to: Create a database table on registering a custom post with metabox #45391[email protected]
ParticipantHello 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!May 5, 2024 at 8:51 PM in reply to: Create a database table on registering a custom post with metabox #45377[email protected]
ParticipantHello 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
May 1, 2024 at 12:59 AM in reply to: Create a database table on registering a custom post with metabox #45352[email protected]
ParticipantAlso, 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?
May 1, 2024 at 12:35 AM in reply to: Create a database table on registering a custom post with metabox #45351[email protected]
ParticipantHello,
Can you please explain why using custom models over custom tables is suggested?
March 20, 2024 at 11:12 PM in reply to: Add Select Values from within the Custom Fields Group #44945[email protected]
Participantpreviously added image not showing up, so adding a url where you can see.
Screenshot of Image linkAugust 16, 2022 at 1:09 PM in reply to: How to output/show the shortcode generated by other plugin as is in cp loop #37516[email protected]
ParticipantI 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?
June 15, 2022 at 6:13 PM in reply to: can't retrieve settings page, group field single image data/value/image url #36506[email protected]
ParticipantSorry 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.
June 14, 2022 at 7:07 PM in reply to: can't retrieve settings page, group field single image data/value/image url #36478[email protected]
Participantsorry 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?
-
AuthorPosts