Forum Replies Created
-
AuthorPosts
-
Jeremy Parrott
ParticipantI don't have that code... I tried this and many other combinations.
$prefix = '';
$post_parent = ($_POST['post_parent']);
$post_id = null;
if ( isset( $_GET['post'] ) ) {
$post_id = intval( $_GET['post'] );
} elseif ( isset( $_POST['post_ID'] ) ) {
$post_id = intval( $_POST['post_ID'] );
}Jeremy Parrott
ParticipantAny update on fixing the icons for the tabs?
Jeremy Parrott
ParticipantThat didn't work.
I think the code is correct but I did change the post_types from "Monitor" to "Controller" in the first few lines of code to test.
$meta_boxes[] = [ 'title' => __( 'Monitor Fields', 'your-text-domain' ), 'id' => 'monitor-fields', 'post_types' => ['<strong>monitor</strong>'], 'storage_type' => 'custom_table', 'table' => 'monitor_table',I left this code "as-is" and it looks correct to me:
[ 'name' => __( 'Controller', 'your-text-domain' ), 'id' => $prefix . 'controller', 'type' => 'post', 'post_type' => ['controller'], 'field_type' => 'select', 'query_args' => [ 'orderby' => 'post_title', 'order' => 'ASC', 'post_parent' => $post_id, ], 'tab' => 'monitor_details',Here's a screenshot of what I'm trying to do: https://pasteboard.co/hquFYGyQQILC.png
Jeremy Parrott
ParticipantI still can't get this to work. Here's example code in my functions.php file.
function monitor_set_controller_number( $meta_boxes ) { $prefix = ''; $post_id = null; // Method #1 - DID NOT WORK ($post_id is NULL) // if ( isset( $_GET['post'] ) ) { // $post_id = intval( $_GET['post'] ); // } elseif ( isset( $_POST['post_ID'] ) ) { // $post_id = intval( $_POST['post_ID'] ); // } // Method #2 - DID NOT WORK ($post_id is NULL) // $post_id = $GLOBALS['post']->ID; // Method #3 - DID NOT WORK ($post_id is NULL) // $post_id = rwmb_meta( $field_id ); $meta_boxes[] = [ 'title' => __( 'Monitor Fields', 'your-text-domain' ), 'id' => 'monitor-fields', 'post_types' => ['monitor'], 'storage_type' => 'custom_table', 'table' => 'monitor_table', 'tabs' => [ 'monitor_details' => [ 'label' => 'Monitor Details', 'icon' => 'chart-bar', ], 'tank_configuration' => [ 'label' => 'Tank Configuration', 'icon' => 'category', ], 'local_display_fields' => [ 'label' => 'Local Display Fields', 'icon' => 'money', ], ], 'fields' => [ [ 'name' => __( 'Location', 'your-text-domain' ), 'id' => $prefix . 'physical_location', 'type' => 'post', 'post_type' => ['location'], 'field_type' => 'select', 'order by' => 'post_id', 'tab' => 'monitor_details', ], [ 'name' => __( 'Active', 'your-text-domain' ), 'id' => $prefix . 'monitor_active', 'type' => 'switch', 'style' => 'square', 'on_label' => 'Active', 'off_label' => 'Inactive', 'std' => true, 'tab' => 'monitor_details', ], [ 'name' => __( 'Controller', 'your-text-domain' ), 'id' => $prefix . 'controller', 'type' => 'post', 'post_type' => ['controller'], 'field_type' => 'select', 'query_args' => [ 'orderby' => 'post_title', 'order' => 'ASC', 'post_parent' => $post_id, ], 'tab' => 'monitor_details', ], :It seems like the post doesn't exist at the time the functions.php is included so it's not defined.
I know it's reading in the functions.php file because I can change $post_id to 200017 and it brings up the correct controllers.
Jeremy Parrott
ParticipantYou can delete this post. I posted on the wrong site!
October 21, 2021 at 9:55 PM in reply to: Filter contents of 1 Dropdown with value from another dropdown. #31436Jeremy Parrott
ParticipantThere's also the "Set as parent" option in the Field group. Maybe that in combination with the above might work?
October 21, 2021 at 9:48 PM in reply to: Filter contents of 1 Dropdown with value from another dropdown. #31435Jeremy Parrott
ParticipantCan I make this work if I use the "Hierarchical [X] Whether the post type is hierarchical." checkbox and make the Model CPT a child of the Make CPT or some combination thereof?
Jeremy Parrott
ParticipantAny word on when this will be working again?
Jeremy Parrott
ParticipantHas there been any progress on this? I am currently having the same issue where the map.rendered tag is not displaying my map...
August 25, 2021 at 5:00 AM in reply to: ✅Change Title to Custom field using "rwmb__before_save_post" action. #30413Jeremy Parrott
ParticipantThanks, I got it working. The screenshot helped a lot!
August 20, 2021 at 9:29 PM in reply to: ✅Change Title to Custom field using "rwmb__before_save_post" action. #30361Jeremy Parrott
ParticipantI've added the following code to my functions.php but it is not updating the title.
add_action( 'rwmb_monitor_after_save_post', 'update_post_title' ); function update_post_title( $post_id ) { // Get the field value $my_meta = rwmb_meta( 'monitor_number', '', $post_id ); // Get the post title //$my_post_title = get_the_title( $post_id ); NOT NEEDED - I'M OVERWRITING THE TITLE // Preprare update post $my_post = array( 'ID' => $post_id, 'post_title' => $my_meta, ); wp_update_post( $my_post ); }My CPT slug is "monitor" and my field slug is "monitor_number".
What am I doing wrong?
Jeremy Parrott
ParticipantAre you guys still working on the dashicons bug?
Jeremy Parrott
ParticipantAny updates on how I can import my data? I have 7 custom tables with up to 100,000 rows. I just purchased the plugin so I know I have 14 days to figure this out, but I was hoping to replace Toolset with Meta Box specifically for the custom table functionality. However, if I cannot import my data, I don't see this as an option.
Otherwise, I love your plugin so far!
-
AuthorPosts