Forum Replies Created
-
AuthorPosts
-
Jackky
ParticipantYep, looks good.
My main idea was to create something, that will allow to create unlimited types of ui grid, not only strict 12 columns.
Jackky
ParticipantNote, that metaboxes appears only when you EDIT existing term, not when you are on the "main" page of all terms.
If they still not working, set DEBUG to true in your wp_config.php and see what you get in errors.
Jackky
Participant$meta_boxes[] = array( 'title' => 'Flex Metabox', 'tabs' => array( 'tab_1' => array( 'label' => 'Sample tab 1', ), 'tab_2' => array( 'label' => 'Sample tab 2', ), ), 'fields' => array( 'flex' => array( //defining, css display: flex; wrapper, can be used without any openssl_get_cert_locations 'align-items' => 'center', //simular to css align-items prop. 'justify-content' => 'flex-end', //simular to css justify-content prop. 'flex-wrap' => 'wrap', //simular to css flex-wrap prop. Used in case when you want to build your metabox mobile-friendly 'flex-direction' => 'row-reverse', //simular to css flex-direction prop. 'class' => 'custom-class', //if user want to define it's own style for this flex wrapper 'tab' => 'tab_1', 'fields' => array( //can hold single fields or new field types 'flex-item' or mixed 'flex-item' => array( 'flex-basis' => '50%', //simular to css flex-basis prop. Could handle any type af value, for example 100px, 33%, calc(100% - 50px) 'flex-shrink' => '0', //simular to css flex-shrink prop. 'fields' => array( array( 'name' => 'Sample Field 1', 'id' => 'sf1', 'type' => 'text', ), array( 'name' => 'Sample Field 2', 'id' => 'sf2', 'type' => 'text', ) ) ), array( //an example for single field without 'flex-item' div wrapper 'name' => 'Sample Field 3', 'id' => 'sf3', 'type' => 'text', 'flex-basis' => '200px', //can hold flex props too 'flex-shrink' => '0', ) ) ), array( //an example for single field outside flex wrapper. It's behave itself like common field 'name' => 'Sample Field 4', 'id' => 'sf4', 'type' => 'text', 'tab' => 'tab_1', ), array( //an example for single field outside flex wrapper and in another tab. It's behave itself like common field 'name' => 'Sample Field 5', 'id' => 'sf5', 'type' => 'text', 'tab' => 'tab_2', ) ) );It's very heavy, I know. And this extension will be for pro users, who defenetely know for what they use it and know what css flex is.
The advantages of this idea:
1) Flexbox is native and, excepting lot's of nested arrays, it's very simple. Also if developer will have very heavy nested array - he can just define each block as single outside and use it like 'fields' => $product_attr_array - I have such experiense for one o my projects (social network)
2) It's allows to build any type of UI. Nested mobile-friendly columns, vertical-alignment ect. - anything you want. Some developers like me need this feature, I know (for now I need to break my mind with wrapping fields with 'custom_html' fields and other tricks)
3) This extension is easy to create. Also if you don't like my idea, I will try to make this extension by my own. I think it will not take lots of time.Jackky
ParticipantOh, suddenly I've got another great idea: just make a flex-grid based extension with a markup, such as I gave. If you like it, I can generate here the full list of options.
Jackky
Participantif (is_admin()) { add_filter( 'rwmb_meta_boxes', 'user_profile' ); }Jackky
ParticipantYes, it's the solution for someone, but group type saving a serialized array, but I need each value stay single in case to organize searching and filtering on the front. That's why I'm ready to deal with tonns on nested arrays in the markup example, I gave.)
Jackky
ParticipantA nightmare, yes, it will be) But you can add this like advanced markup for those crasy coders, like me) I really need a feature to wrap 2-3 fields in one column and add empty columns to build beautiful UI inside admin area. And I think, I'm not alone with this perfectionism.
Add: also with this type of array markup there will be a feature to make nested columns.
Jackky
ParticipantNope, that will be easier to use, here an example
fields => array ( columns => array( size => 4, class => 'custom-column-class', fields => array( 'name' => 'Group', // Optional 'id' => 'group_id', 'type' => 'group', // List of sub-fields 'fields' => array( array( 'name' => 'Text', 'id' => 'text', 'type' => 'text', ), // Other sub-fields here ), ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here or leave empty ), ), )Jackky
ParticipantAnd another my thought: maybe it will be more user-friendly to make API looking like this:
fields => array ( columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here or leave empty ), ), )Jackky
Participant*also can't find any markup buttons for code wrap here, sorry
Jackky
ParticipantThat's because WPML made a unique new page for each translation, so you need to choose post metas twise.
Jackky
Participant*forum gives wrong category. This is general question.
Jackky
ParticipantThat's why I suggest to make a new array option for this purpose. Not to "hardcode" this logic.
Jackky
ParticipantFor example for my multilingual project (5 langs for now) I'm using WP core textdomain where I can do so. It seems to be very good for my purposes.
Jackky
ParticipantSo the callback tries to print content anyway? Why you chose this solution?
-
AuthorPosts