Support Forum ยป User Profile

Forum Replies Created

Viewing 15 posts - 3,841 through 3,855 (of 3,958 total)
  • Author
    Posts
  • in reply to: Sort fields #1101
    Anh TranAnh Tran
    Keymaster

    I think you can do that with custom JS code. The idea is:

    - Enqueuing a JS file for Add New/Edit pages
    - Call jQueryUI sortable method

    The pseudo-code might look like this:

    add_action( 'admin_enqueue_scripts', function()
    {
        $screen = get_current_screen();
        if ( 'team' == $screen->post_type && 'post' === $screen->base )
        {
            wp_enqueue_script( 'prefix-sort-field', get_theme_directory_uri() . '/js/sort.js', array( 'jquery-ui-sortable' ) );
        }
    } );

    And in sort.js:

    jQuery( function ( $ )
    {
    	$( '.rwmb-input' ).sortable();
    } );

    Hope that helps.

    in reply to: Finish a column #1100
    Anh TranAnh Tran
    Keymaster

    It does have clear floats, of course. But the thing is the plugin needs correct number of columns to output correct opening and closing divs. You can see it in the console like this:

    Here is an example to illustrate what I meant in previous reply: assuming we have 2 rows, 1st row has 2 fields (each field has 1/4 width), 2nd row has 4 fields (each field has 1/4 width):

    add_filter( 'rwmb_meta_boxes', function ()
    {
    	return [
    		[
    			'title'  => 'Demo columns',
    			'fields' => [
    				[
    					'id'      => 'text1',
    					'type'    => 'text',
    					'name'    => 'Text1',
    					'columns' => 3,
    				],
    				[
    					'id'      => 'text2',
    					'type'    => 'text',
    					'name'    => 'Text2',
    					'columns' => 3,
    				],
    				[
    					'type'    => 'custom_html',
    					'std' => '',
    					'columns' => 6,
    				],
    				[
    					'id'      => 'text5',
    					'type'    => 'text',
    					'name'    => 'Text5',
    					'columns' => 3,
    				],
    				[
    					'id'      => 'text6',
    					'type'    => 'text',
    					'name'    => 'Text6',
    					'columns' => 3,
    				],
    				[
    					'id'      => 'text7',
    					'type'    => 'text',
    					'name'    => 'Text7',
    					'columns' => 3,
    				],
    				[
    					'id'      => 'text8',
    					'type'    => 'text',
    					'name'    => 'Text8',
    					'columns' => 3,
    				],
    			],
    		]
    	];
    } );
    in reply to: WSYIWYG seems to be broken when using groups #1097
    Anh TranAnh Tran
    Keymaster

    Hi, I think there must be some JS errors which prevent the editor to be rendered properly. Do you see any errors in browser console?

    in reply to: Metabox hidden using the same id #1088
    Anh TranAnh Tran
    Keymaster

    Hi catarinacarraro,

    Thanks for your question, unfortunately, we're currently not support that feature yet. We'll mention it to think a way to improve our Conditional Logic.

    Thanks and Best Regards.

    Tan Nguyen

    in reply to: Finish a column #1087
    Anh TranAnh Tran
    Keymaster

    An easy way to do that is keep adding 4 fields for columns, but you can use a special field like custom_html with zero content. That forces the plugin to output empty divs in the column which helps to maintain the layout.

    in reply to: How to retrieve select_tree taxonomy values #1086
    Anh TranAnh Tran
    Keymaster

    Hi, currently the rwmb_meta function uses get_terms() internally and this function doesn't return terms in hierarchical order. I think the best way for now is going through the returned items, looking for parent parameter to get the correct order.

    in reply to: STD in metabox RADIO #1085
    Anh TranAnh Tran
    Keymaster

    Hi catarinacarraro,

    I've just tested with your code and I see the std value works, the radio with value "Em" is checked by default:

    in reply to: STD in metabox RADIO #1076
    Anh TranAnh Tran
    Keymaster

    Can you please send me your meta box code? So I can fix it for you.

    in reply to: Metabox hidden using the same id #1075
    Anh TranAnh Tran
    Keymaster

    Hi catarinaarraro,

    As your logic, this is my snippet, you can edit to fit to your project:

    
    add_filter( 'rwmb_meta_boxes', function( $meta_boxes )
    {
    	$meta_boxes[] = array(
    		'id' 			=> 'brand_product',
    		'title' 		=> 'Brands and Products',
    		'post_types' 	=> array( 'post', 'page' ),
    		'context'		=> 'normal',
    		'priority'		=> 'high',
    		'fields' => array(
    			array(
    				'id'	=> 'fone_id',
    				'name'	=> 'Brand',
    				'desc'	=> 'Pick Your Favourite Brand',
    				'type'	=> 'select',
    				'options' => array(
    					'apple' 		=> 'Apple',
    					'android' 		=> 'Android',
    					'windowsphone' 	=> 'WindowsPhone'
    				)
    			),
    			array(
    				'id' 	=> 'apple_products',
    				'name'	=> 'Select your apple product?',
    				'type'	=> 'checkbox_list',
    				'options' => array('iPhone', 'iPad', 'iPod'),
    				'visible' => array( 'fone_id', '=', 'apple' )
    			),
    			array(
    				'id' 	=> 'android_products',
    				'name'	=> 'Select your android product?',
    				'type'	=> 'checkbox_list',
    				'options' => array('Galaxy', 'ZenPhone', 'Tablet'),
    				'visible' => array( 'fone_id', '=', 'android' )
    			),
    			array(
    				'id' 	=> 'windowsphone_products',
    				'name'	=> 'Select your apple product?',
    				'type'	=> 'checkbox_list',
    				'options' => array( 'Nokia', 'Galaxy' ),
    				'visible' => array( 'fone_id', '=', 'windowsphone' )
    			)
    		)
    	);
    
    	return $meta_boxes;
    } );
    

    Best regards

    Tan Nguyen

    in reply to: Existing Values Before Group was Created #1073
    Anh TranAnh Tran
    Keymaster

    I'm really sorry that you have spent much of time searching for the solution. I was on a holiday last week and couldn't answer you sooner. Hope you be generous and still love the plugin.

    in reply to: Existing Values Before Group was Created #1071
    Anh TranAnh Tran
    Keymaster

    Hi, in order to convert data from 1 format to another format, you need to understand how data is saved in the database. Here is the documentation for this. For group, data is saved as an array, each element of which is the value of sub-fields.

    In this case, if you are using simple text field, your data is just multi rows in the database, so getting values will not be a big problem. But I'm not clear how you want to put them in a group? Will the text field is a sub-field of the new group? If so, you can use the following code:

    <?php
    $text_id = 'TEXT_FIELD_ID';
    $group_id = 'GROUP_FIELD_ID';
    
    $posts = get_posts( array(
    	'posts_per_page' => -1,
    ) );
    foreach ( $posts as $post )
    {
    	$text = rwmb_meta( $text_id, 'type=text', $post->ID );
    
    	$meta_key = "{$group_id}[{$text_id}]";
    	update_post_meta( $post->ID, $meta_key, $text );
    
    	// delete_post_meta( $post->ID, $text_id ); // Remove old data, use with care
    }
    in reply to: Bug: MetaBox Group #1057
    Anh TranAnh Tran
    Keymaster

    I think I understand now, but it's still better to have screenshots ๐Ÿ˜€

    in reply to: Metabox List all Pages #1053
    Anh TranAnh Tran
    Keymaster

    Hi, you can use post field with 'post_type' => 'page'.

    in reply to: Bug: MetaBox Group #1052
    Anh TranAnh Tran
    Keymaster

    Hi Flickweert,

    I'm not very clear about the bug. Do you mean that when adding max_clone, it still allows you to add infinite number of clones? And when you remove a clone, the "Add more" button disappear?

    in reply to: Image in group #1042
    Anh TranAnh Tran
    Keymaster

    Hi Flikweert,

    I understand your concern, but there's no way to handle image upload in the group for now.

    But you can use another way to achieve that by using file_input field. It works similar to all image fields (can Browse or Upload images), but doesn't have preview. It's not 100% perfect for your needs, but it works for now.

Viewing 15 posts - 3,841 through 3,855 (of 3,958 total)