Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterYes, but that requires some custom code. Here is what I tried:
- In your plugin file or theme's
functions.phpadd this code:add_action( 'admin_init', 'prefix_custom_post_column', 20 ); function prefix_custom_post_column() { require_once 'custom.php'; new Test_Admin_Columns( 'post', array() ); }- Create a new file
custom.phpand enter the following code:class Test_Admin_Columns extends MB_Admin_Columns_Post { public function columns( $columns ) { $columns = parent::columns( $columns ); /** * Add more column in a specific position * * @param string $position New column position. Empty to not specify the position. Could be 'before', 'after' or 'replace' * @param string $target The target column. Used with combination with $position */ $position = ''; $target = ''; $this->add( $columns, 'column_id', 'Column Title', $position, $target ); // Add more if you want return $columns; } public function show( $column, $post_id ) { switch ( $column ) { case 'column_id': echo 'Column content'; break; // More columns } } }Note that the call
new Test_Admin_Columns( 'post', array() );is specific forpost. You can change it to any custom post type if you want.Anh Tran
KeymasterYes, I do. Will release it as soon as I find a solution for ajax handling ๐
Anh Tran
KeymasterDid you set value for
$var_options? Here is my test:<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); function your_prefix_register_meta_boxes( $meta_boxes ) { $prefix = 'mbox_'; $var_options = array( 'a' => 'First option', 'b' => 'Second option', ); $meta_boxes[] = array( 'title' => esc_html__( 'Standard Fields', 'your-prefix' ), 'fields' => array( array( 'name' => esc_html__( 'Depends of', 'pbc' ), 'id' => "{$prefix}depends", 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array( // SELECT BOX VARIATIONS array( 'name' => __( 'Variation', 'pbc' ), 'id' => "{$prefix}depvar", 'type' => 'select', 'options' => $var_options, 'multiple' => false, 'std' => '', 'placeholder' => __( 'Select a Variation', 'pbc' ), ), ), ), //array ), ); return $meta_boxes; }And here is the result:
Anh Tran
KeymasterHi Cristian,
I've just tested with your code and it works for me: http://prntscr.com/bvyab5
Looks like the saved value doesn't have a correct format. Did you have value for the group before? Something like you set up the group, entered a value, and then changed the group settings. That probably makes the old saved data not compatible with the new settings.
Anh Tran
KeymasterHi @jpomranky,
Can you please check the version of the Group extension you're using? I think I fixed this bug in the extension and keep the
clone.jsfile untouched.Anh Tran
KeymasterHi Nicolas,
You can store the changed fields and then process the log when the post is saved. Here is what I suggest:
class MB_Log { protected $fields = array(); public function __construct() { add_filter( 'rwmb_value', array( $this, 'check_field_change' ), 20, 3 ); add_action( 'rwmb_after_save_post', array( $this, 'log' ) ); } public function check_field_change( $new, $field, $old ) { if ( $new !== $old ) { $this->fields[] = $field; } return $new; // Do not change the value } public function log() { foreach ( $this->fields as $field ) { // Log } } }Anh Tran
KeymasterHi Nicolas,
I think you can hook to
rwmb_valuelike this:add_filter( 'rwmb_value', 'prefix_check_field_change', 20, 3 ); function prefix_check_field_change( $new, $field, $old ) { if ( $new !== $old ) { // Log } return $new; // Do not change the value }Anh Tran
KeymasterThanks for reporting. I will check it.
Anh Tran
KeymasterThe
$contact['phone']is an array, so you need to loop for it:// Echo name, email if ( ! empty( $contact['phone'] ) ) { echo '<p><label>', __( 'Phone numbers:', 'textdomain' ), '<label> '; foreach ( $contact['phone'] as $k => $phone ) { echo $k ? ', ' : '', $phone; } // Or faster echo implode( ', ', $contact['phone'] ); }Anh Tran
KeymasterSorry, that was a typo mistake. I've just updated the plugin with the fix. Please re-download it.
Thanks
AnhAnh Tran
KeymasterHi @Unce,
The custom fields for terms are displayed when you editing a term. Currently the plugin doesn't support show custom fields in the Add new page.
Anh Tran
KeymasterJust updated the extension with fix. Please download and try it.
Anh Tran
KeymasterLet me check that.
Anh Tran
KeymasterAre you using old version of the Meta Box plugin? This class is available since 4.8.0.
Anh Tran
KeymasterJust sent you an email ๐
-
AuthorPosts